When to use Vanilla JavaScript vs. jQuery?

后端 未结 13 2082
独厮守ぢ
独厮守ぢ 2020-11-22 09:08

I have noticed while monitoring/attempting to answer common jQuery questions, that there are certain practices using javascript, instead of jQuery, that actually enable you

13条回答
  •  深忆病人
    2020-11-22 09:46

    There's a framework called... oh guess what? Vanilla JS. Hope you get the joke... :D It sacrifices code legibility for performance... Comparing it to jQuery bellow you can see that retrieving a DOM element by ID is almost 35X faster. :)

    So if you want performance you'd better try Vanilla JS and draw your own conclusions. Maybe you won't experience JavaScript hanging the browser's GUI/locking up the UI thread during intensive code like inside a for loop.

    Vanilla JS is a fast, lightweight, cross-platform framework for building incredible, powerful JavaScript applications.

    On their homepage there's some perf comparisons:

    enter image description here

提交回复
热议问题