Comparison of performance between jquery and native JS in different browsers (Chrome,firefox,ie)

Source: Internet
Author: User

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!!!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.