简体   繁体   中英

how to speed up getJSON array data

I have a huge array(4MB) data on the server side. right now I'm using jquery getJSON method to get the array data and render the whole array on the browser. It turns out getting the array data is too slow. Probably the main time is spent on JSON parsing,probably not. What is the best/fastest way to get such array kind of data from server?

Four MegaBytes is a lot of data to be sending client side in all one go? Rather than trying to speed up how fast JavaScript can process JSON, i suspect your best bet will be to figure out some tactics to break the data up a bit more (so you can work with less at a time).

I mean, do you really need all of it at once? Its probably worth looking in to adding some server side filtering to the JSON being returned so as to try and limit it only to the data needed to do whatever you apps supposed to be doing?

For example, if your planning to display a massive list of products, it may be worth just loading the first 50-100, then as the user scrolls down the page make a second call to load the next 50-100 etc?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM