I was reading a thread and saw this post, which says that Javascript is faster than Jquery because it uses native code. But why is the use of native code faster? Is this always the case? What impediments does Jquery have in performance?
closed as unclear what you're asking by gnat, GlenH7, GrandmasterB, Kilian Foth, Glenn Nelson Dec 19 '13 at 14:02Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question. |
|||||
|
First of all, we have to get something straight: Javascript and jQuery are not two completely different things: jQuery is a Javascript library.
That said, the common trend among programming languages and libraries is that the library is always going to be slower because it is more code to run alongside your actual program. For more information, check out this post. It's pretty similar to what you're asking. |
||||
|
The link you posted is not that JavaScript is faster per se, but rather that calling the native DOM method is faster than calling a JavaScript abstraction that eventually calls the same DOM method. For tasks that jQuery does well, such as gathering a list of DOM elements based on a class name, it would be difficult to write a "pure" JavaScript function that does the same task measurably faster. (There are the occasional browser-specific optimization... but jQuery already includes several.) |
|||
|