Skip to content
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.

Already on GitHub? Sign in to your account

SC.Array#someProperty doesn't seem to have a fast path #1336

Open
mauritslamers opened this issue Mar 7, 2015 · 1 comment
Open

SC.Array#someProperty doesn't seem to have a fast path #1336

mauritslamers opened this issue Mar 7, 2015 · 1 comment

Comments

@mauritslamers
Copy link
Member

I came across the someProperty method in SC.Enumerable (https://github.com/sproutcore/sproutcore/blob/master/frameworks/runtime/mixins/enumerable.js#L588), and I was wondering why it doesn't have a fast path. I would expect that if one item was found to be matching, it can return immediately.
I didn't test this, but while I can imagine the extra check in the loop to be relatively expensive for small arrays, I would think that for larger arrays it could provide a speed up.

Thoughts?

@nicolasbadia
Copy link
Member

someProperty doesn't seem to be used in SC, and since I don't use it either, I can't help you much with that...
But returning true as soon as an item is found indeed sound like a good idea.

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