Inspired by Nicholas C. Zakas's Timed array processing in JavaScript.
An example of loading large table data: array-processing.html
Notes:
- The timedChunk function is the essence, in which 50 ms is from the results of the Response Time Overview Survey: The Response within 100 ms can make the user feel very smooth. 50 ms is the best JavaScript experience of Nicholas.
- The latency of setTimeout is 25 ms because of the time resolution problem of the browser. 25 ms ensures that mainstream browsers are smooth (there is a chance to update the UI ).
- In the above example, loading in the traditional way will make the browser unable to update the interface and respond to any operation during data loading. With time-sharing loading, the browser can always be responsive, improving the smoothness of the interface and user experience.
- Gossip by the way: Safari 4 and Chrome 2 are really not blowing, and the speed is too high. Firefox and IE are slow enough.
- Opera still maintains the characteristics of geeks, and the traditional loading method can also maintain interface updates and responses, but it is a pity that the speed is not good and mixed.
- In the end, I admire the short piece of code in Nicholas C. Zakas, which contains knowledgeable usable knowledge, professional JS skills, and careful crazy testing. Such a cool person is an excellent example for learning.
Source: http://lifesinger.org