Hearaman
Hearaman

Reputation: 8726

What is the maximum size of data that can be stored in angularjs scope? Performance of the application with heavy scopes?

Previously i have done some small small examples with Angular JS. I have a doubt on angular $scope in terms capability to store large data sets & performance with large data sets.

Example: In hotel booking systems(like http://www.hotels.com) , Usually Hotel APIs(Hotelbeds, DOTW...) gives hundreds of hotels for Bangkok, Dubai, Spain... etc like popular destinations.

My Question is,

  1. Can Application work without loosing performance when we assign this much data to Angular Scope?

  2. What is the maximum size of data that can be stored in Angular Scope?

Upvotes: 7

Views: 6400

Answers (2)

fgul
fgul

Reputation: 6531

I recommend that you stay under 2000 watchers for performance reasons.

There are several ways to count how many you have, but the easiest for a beginner is to use the Angular Watchers Chrome extension.

Upvotes: 1

Akallabeth
Akallabeth

Reputation: 343

In my experience when you work with a large amount of DOM nodes, each one containing several DOM nodes, sooner or later your application performances will be affected: it just happens to all javascript client side applications bacause it depends on your computer cpu and ram.

To avoid the problem it's a best pratice to work with small amount of data in your view and, of course, there are few techniques like infinite scrolling that help reaching the purpose. In general you should show in your view few dom nodes each time a user make an action (like scrolling, page changing, or filtering).

See this interesting article: AngularJS Virtual Scrolling

If you want to check an angularjs application performaces use Batarang

Upvotes: 9

Related Questions