-
Notifications
You must be signed in to change notification settings - Fork 6
Performance with AngularJS #15
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
Comments
Thanks for bringing this up. There are a couple ways to deal with this at the moment:
I am planning to add a batch create method that can create many items at once. |
|
Oh yeah, I forgot. Other adapters that connect to actual databases are able to optimize this method. localStorage doesn't have any collection-based operations.
Something like this:
Yes, but only if you want to be able to call |
Hello Jason,
I think there is a big performance problem in part of this adapter when using with AngularJS.
If you are calling
create
ordestroy
on many items (thousands), you end up with$rootScope.$apply
for every item, and huge lags!Why?
setTimeout
is called for every injected item here https://github.com/js-data/js-data-localstorage/blob/master/src/index.js#L44inject
for that item is invoked$apply
as reaction on that https://github.com/js-data/js-data-angular/blob/master/src/index.js#L199I have replaced
setTimeout
for sync callback as hotfix, but I am not sure if thats good.The text was updated successfully, but these errors were encountered: