7
I personally love and use the jQuery library.
This library influences the "performance" of the application?
7
I personally love and use the jQuery library.
This library influences the "performance" of the application?
9
Yes.
The jQuery is a relatively heavy library. Whenever you use jQuery switches you will be running many functions that can weigh in the performance of the application.
For example, if you want to know id
of an element you can do in jQuery $(el).attr('id')
but you can get the same using pure Javascript with el.id
, the difference in performance is great: http://jsperf.com/browser-diet-this-attr-id-vs-this-id/12
Of course it is useful to use jQuery, or Mootools, or another library. But as Javascript evolves it becomes easier to do what is needed with native code (or CSS) and no loss of performance.
This jsperfom only of the tbm selector is legal to compare https://jsperf.com/jquery-vs-javascript-performance-comparison/22
6
No doubt it does. It’s an extra layer that will perform extra things that are not always needed if you do it directly in Vanilla JS.
Beyond that, hiding things can help on one side and can complicate things on the other. It is not always easy to perceive the inefficiencies of what is being done when using a library. It is true that if the programmer does not understand the inefficiencies of the language, the standard library or even the computer in general, it makes no difference.
The blame can be directly from jQuery, it can be from the programmer using it but it can also be from plugins for jQuery that are not always well written. But even the ones that are will still have losses by being an extra bed.
Some people put the cost of loading the library as another way to make performance worse. Of course to load in memory and prepare any environment has a cost but this cost they complain is that of the charge of the download via the internet. This makes sense and can eventually happen and degrade your page load significantly. But if the page uses the technique of loading the minimized file of a CDN that everyone uses, such as the officer or of Google that many people use, will use the cache and will not need to do download.
I’m not saying that this loss makes its use impossible, of course, if it were so, there would be many people making a very serious mistake. What I criticize most is when there is abuse. Some people have turned a library into language. Then one cannot do anything else in JS even when clearly the JS is better at speed, readability, etc. The problem becomes greater when the programmer uses to type less - and not make the code more concise, which is a virtue.
But for most tasks this loss does not affect significantly.
Which one do you think is faster? One for each
simple or the each
(see the code of link) jQuery that beyond the for each
does a lot of things?
2
Yes influence, however in most cases the difference is irrelevant in the final result because the Javascript engines in the current browsers are extremely efficient and jQuery is already well optimized.
You will see around several people showing as selectors or native methods of browser type document.getElementById
are incredibly faster than jQuery equivalents (like $('')
or $(...).prop('id')
) and it is true, the wrapper method is much less efficient, but still you will have to strive quite a lot to reflect negatively on performance perceptible of your application. Generally performance problems come from bad code and not from the overhead caused by the library being used, an excellent example being this post by John Resig that talks about a case where twitter was crashing when the user scrolled on the page, the result of a function that queried the DOM every scroll made (which is very, very bad).
It’s not part of your question (it’s already been answered in "Yes", the first word of this answer ;)) but I’ll leave you with the advice that unless you’re making an app that needs a very high level of optimization if you stick to using jQuery (or another equivalent lib) since it takes away several existing headaches when writing raw javascript (it gives you a simpler API, more readable code, uniform behavior between browsers, etc).
Browser other questions tagged javascript jquery performance
You are not signed in. Login or sign up in order to post.
Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?
– Maniero