Skip to content

Performance with AngularJS #15

@radarfox

Description

@radarfox

Hello Jason,

I think there is a big performance problem in part of this adapter when using with AngularJS.

If you are calling create or destroy on many items (thousands), you end up with $rootScope.$apply for every item, and huge lags!

Why?

  1. In this adapter setTimeout is called for every injected item here https://github.com/js-data/js-data-localstorage/blob/master/src/index.js#L44
  2. In each of timeout execution inject for that item is invoked
  3. And then js-data-angular call $apply as reaction on that https://github.com/js-data/js-data-angular/blob/master/src/index.js#L199

I have replaced setTimeout for sync callback as hotfix, but I am not sure if thats good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions