The browser for this test is Chrome (36.0.1985.125m), Firefox (31.0), IE (8.0)
1. Compare jquery execution performance for JS in different browsers
Calculate the time required to insert 20,000 div nodes
for (var i=0;i<20000;i++) { var divtag = document.createelement (' div '); $ ("#chn"). Append (Divtag); }
Result:
Time Unit ms
Chrome |
584 |
614 |
593 |
574 |
596 |
Firefox |
552 |
30] |
531 |
527 |
633 |
Ie |
6221 |
6187 |
6235 |
6127 |
6202 |
Chrome and Firefox are basically close, IE8 performance is not flattering ...
2. Compare native JS writes on the execution performance method in different browsers
Use JS's appendchild to replace jquery's append
for (var i=0;i<20000;i++) { var divtag = document.createelement (' div '); document.getElementById ("CHN"). appendchild (Divtag); // $ ("#chn"). Append (Divtag);
Time Unit ms
Chrome |
25 |
21st |
24 |
30 |
22 |
Firefox |
42 |
41 |
43 |
42 |
40 |
Ie |
311 |
60W |
305 |
305 |
307 |
Data can't bear to look straight, let jquery heavy user sentiment why.
Chrome has more than twice times the native JS execution speed and is about 30 times times faster than the jquery implementation.
Firefox is more than 10 times times faster than jquery in native JS execution;
ie if the use of native JS, the speed increased by 20 times times;
Conclusion:
- If you develop with jquery, Chrome and Firefox do the same speed.
- If you use native JS development, Chrome engine performance is the most prominent.
- If the development of a large number of JS operation, decisive use of the original JS to encode, or IE users will crash!!!