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.
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.
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.
jQuery has own layer which translate into native JavaScript , so definitely native JavaScript will be faster.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With