Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery speed vs javascript speed [closed]

I know Jquery is just a library of javascript.

is Jquery animation and events slower then javascript? If so, how much slower.

i am trying to decide if i should rewrite my site in native javascript.

like image 973
THE AMAZING Avatar asked Aug 24 '13 12:08

THE AMAZING


People also ask

Is jQuery faster than JavaScript?

Pure JavaScript can be faster for DOM selection/manipulation than jQuery as JavaScript is directly processed by the browser and it curtails the overhead which JQuery actually has. JQuery is also fast with modern browsers and modern computers. JQuery has to be converted into JavaScript to make it run in a browser.

Is jQuery slower than JS?

A. When it comes to speed, jQuery is quite fast for modern browsers on modern computers. So is pure JavaScript but both run very slow on older browsers and machines. Pure Javascript functions will be faster than jQuery operations.

Why is jQuery so fast?

jQuery has own layer which translate into native JavaScript , so definitely native JavaScript will be faster.

What are advantages of using jQuery over JavaScript?

jQuery simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is easier to use compared to JavaScript and its other JavaScript libraries. You need to write fewer lines of code while using jQuery, in comparison with JavaScript.


1 Answers

jQuery in terms of speed is quite fast for modern browsers on modern computers. So is pure JavaScript. Both run drastically slower on older browsers and machines.

Pure Javascript to access the DOM can be faster as you can cut the overhead that jQuery has on this. However it doesn't always have to be faster as you could write some major mistakes that slow things down again. jQuery on the other hand has been battle tested over the past few years and is proven to be performant.

Another thing is, jQuery wasn't specifically designed with mobile devices in mind. Events like click cause a delay due to this fact (~300ms). jQuerys animations are also quite slow on the average mobile device because the way they are written makes them CPU bound, an average mobile device doesn't have alot of CPU power. A way around this is by using hardware accelerated CSS animations.

like image 114
Hless Avatar answered Oct 22 '22 12:10

Hless