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

Batch record arrays #4849

Merged
merged 1 commit into from
Mar 14, 2017
Merged

Conversation

stefanpenner
Copy link
Member

@stefanpenner stefanpenner commented Mar 9, 2017

@stefanpenner stefanpenner force-pushed the batch-record-arrays branch from d8d72ab to 375590d Compare March 9, 2017 17:04
@stefanpenner
Copy link
Member Author

This is ready to review.

@stefanpenner
Copy link
Member Author

stefanpenner commented Mar 9, 2017

on emberaddons.com prior to this change, we spend 80ms+ merely n+1 adding all the records to the RecordArray:

screen shot 2017-03-09 at 12 17 24 am

after we do that in like 7ms:

screen shot 2017-03-09 at 10 16 54 am

by batching


To avoid thrashing, it only runs at most once per run loop.
let models = pending[modelName] = pending[modelName] || [];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should happen after 100


recordArrays.forEach(array => array._removeInternalModels([internalModel]));
Object.keys(pending).forEach(modelName => {
let work = pending[modelName].map(internalModel => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

internalModelsToBeProcessed


// process adapterPopulatedRecordArrays
if (modelsToRemove.length > 0) {
this.removeFromRemainingRecordArrays(modelsToRemove);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to removeFromAdapterPopulatedRecordArrays

@stefanpenner stefanpenner merged commit e44824c into emberjs:master Mar 14, 2017
@stefanpenner stefanpenner deleted the batch-record-arrays branch March 14, 2017 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant