-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Optimize the update of a has-many relationship. #7090
Conversation
You can also remove the |
@btecu done ;-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a great idea! I kept thinking that this might result in slightly different behaviour but then I contradicted myself. Nice job. 👍
Can you port the test app to being a route in our relationship performance test app? |
I'm looking into it |
@runspired I just could not figure out how to automate the access to a second route. I could of course chain it to the logic of the existing application route, but then things will quick get messy if more scenarios are added. |
@pieter-v don’t worry about automating the test itself I can add that part fairly easily :) |
@runspired I've updated the relationship performance test app. |
@runspired are we good to go here? |
@igorT all we need to do is rebase so that the new performance test is run so that we can see the output from this change, I am otherwise 👍 on merging this. |
@runspired @igorT rebase done |
|
Analyzing a performance issue in our application, I noticed that updating an existing relationship (with a large number of records) is very expensive. A lot of time is consumed in
Array.splice
.By changing the order: first remove all records in reverse order and then add all records in correct order, is a quick win.
See output of test application that adds each time 200 records to the same relationship until 20.000
Test application can be found ember-has-many-update
Before

After
