8000 performance improvement in JsObservable · Issue #453 · BorisMoore/jsviews · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

performance improvement in JsObservable #453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.< 8000 /p>

Already on GitHub? Sign in to your account

Closed
johan-ohrn opened this issue Aug 12, 2022 · 2 comments
Closed

performance improvement in JsObservable #453

johan-ohrn opened this issue Aug 12, 2022 · 2 comments

Comments

@johan-ohrn
Copy link

I had a performance related issue with JsObservable and a very minor fix that I would like to share.
In jquery.observable.js (v1.0.11) at line 842

	$observable = function(ns, data, delay) {
		if (ns + "" !== ns) {
			delay = data;

change the if statement to

	$observable = function(ns, data, delay) {
		if (typeof ns !== 'string') {
			delay = data;

I think the two are functionally identical? :) Unless I'm missing some subtle point.
Anyway what was happening is that in my case, the variable ns is in fact a very large array of objects and not a namespace. The expression ns + "" produce something like '[object Object],[object Object],..................' and when called over and over on large arrays of objects this became an issue.

@BorisMoore
Copy link
Owner

Thanks Johan.

I won't be able to get to this for a while, but at some point I'll try to look into whether to include it...

BorisMoore added a commit to BorisMoore/jsviews.com that referenced this issue Nov 10, 2022
This update contains a performance improvement, suggested in the issue:
BorisMoore/jsviews#453

All instances of code which test whether an object, someObject, is
of type string by testing:
    if (someObject + "" !== someObject) {...}
have been replaced by more performant code:
    if (typeof someObject !== 'string') {...}

This change applies to jsrender, jsviews and jsobservable files...
BorisMoore added a commit to BorisMoore/jsrender that referenced this issue Nov 11, 2022
This update contains a performance improvement, suggested in the issue:
BorisMoore/jsviews#453

All instances of code which test whether an object, someObject, is
of type string by testing:
    if (someObject 
8000
+ "" !== someObject) {...}
have been replaced by more performant code:
    if (typeof someObject !== 'string') {...}

This change applies to jsrender, jsviews and jsobservable files...

Sync with other changes in v1.0.12 for JsViews
BorisMoore added a commit to BorisMoore/jsviews.com that referenced this issue Nov 12, 2022
This update contains a performance improvement, suggested in the issue:
BorisMoore/jsviews#453

All instances of code which test whether an object, someObject, is
of type string by testing:
    if (someObject + "" !== someObject) {...}
have been replaced by more performant code:
    if (typeof someObject !== 'string') {...}

This change applies to jsrender, jsviews and jsobservable files...
BorisMoore added a commit that referenced this issue Nov 12, 2022
This update contains a performance improvement, suggested in the issue:
#453

All instances of code which test whether an object, someObject, is
of type string by testing:
    if (someObject + "" !== someObject) {...}
have been replaced by more performant code:
    if (typeof someObject !== 'string') {...}

This change applies to jsrender, jsviews and jsobservable files...

Sync with other changes in v1.0.12 for JsViews
BorisMoore added a commit to BorisMoore/jsrender that referenced this issue Nov 12, 2022
This update contains a performance improvement, suggested in the issue:
BorisMoore/jsviews#453

All instances of code which test whether an object, someObject, is
of type string by testing:
    if (someObject + "" !== someObject) {...}
have been replaced by more performant code:
    if (typeof someObject !== 'string') {...}

This change applies to jsrender, jsviews and jsobservable files...

Sync with other changes in v1.0.12 for JsViews
BorisMoore added a commit to BorisMoore/jsrender that referenced this issue Nov 12, 2022
This update contains a performance improvement, suggested in the issue:
BorisMoore/jsviews#453

All instances of code which test whether an object, someObject, is
of type string by testing:
    if (someObject + "" !== someObject) {...}
have been replaced by more performant code:
    if (typeof someObject !== 'string') {...}

This change applies to jsrender, jsviews and jsobservable files...

Sync with other changes in v1.0.12 for JsViews
@BorisMoore
Copy link
Owner

This issue has been resolved in release v1.0.12 (both JsRender and JsViews
91ea2c9
BorisMoore/jsrender@75f2059

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0