-
Notifications
You must be signed in to change notification settings - Fork 325
When adding relations, use a reverse index and one event handler #454
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
base: master
Are you sure you want to change the base?
Conversation
|
Big +1 for working on performance in Backbone-Relational... So that this can get further tested & merged... could you do a cleanup on the code style, remove usage of global |
|
@PaulUithol any thoughts on the overall concept? |
|
@corps, thanks for sharing your work so far! I like the concept a lot, obviously; we could use a speed boost, and this looks like a pretty sane upgrade. I'm pretty strapped for time though; I will need time to read up a bit on what's happening here and to review/improve the current state of this solution. |
|
I'm pondering what the best place is to let this implementation live; the |
|
Okay, I've taken most of the changes in this PR together with some others in the To be honest, I don't see that much improvement yet in the few performance related tests we have; but those are highly artificial (we could use better ones). It also seems that manipulating lots of small objects (as the |
|
In my not-so-scientific tests, I see a consistent 30% performance improvement with this branch when loading a rather large/complex data set. I experienced one crasher though: calling Backbone.Relational.store.unregister on a collection results in "Uncaught TypeError: Cannot read property 'removeRelated' of undefined" on https://github.com/PaulUithol/Backbone-relational/blob/performance/backbone-relational.js#L668 |
|
Thanks, sounds good. I'll look into that crasher. |
Attempts to reduce algorithmic complexity of looking up potential relations added to a model's master collection by requiring only one handler The code is not ideal in style, and could use some additional test exercising, but demonstrates the idea and has been used in my production app successfully.