JQuery / Javascript speed ... do I care?

I have seen many posts comparing the speeds of various select queries and DOM workarounds. Of course, this is important in cases with hundreds or thousands of elements and O ^ n operations, but speed really matters in 99% of cases when JQuery does some DOM manipulation (or whistling animation or making a toast) in response to user action

Won't almost all jQuery actions be faster than the reverse to the server?

It makes sense to develop server-optimized code using UBer. And it makes sense to be responsible for allocating memory and clearing it in javascript, so the user's browser does not work like Flash circa v5. I see no reason to waste time optimizing jQuery / Javascript speed, if only something noticeably slows down the page during testing.

Can someone please tell me if and why I should start to care about jQuery speed?

Edit

My tone, admittedly, is piercing, but not intended for argumentation. There are good resources on how to approach optimization, when you need it here , the best way to ask your question:

What is the impact of suboptimal Javascript / Jquery?
If I don’t notice it, should I worry about it?

, . , , , , ,

  • unit test
  • API , .

" " . , , .

, :

. @Anurag .

+3
5

- , jQuery.

, -, , . - , , .

, .

+7

, , , , .

, , , ?

, ECMA/Javascript , Javascript . , Javascript . , DOM, (: ).

, - Javascript . .

, , .

  • , , .
  • Javascript , . , ,
  • Javascript . , Javascript , .
  • ! , , .

, jQuery, . , ,

$('body > *')

. , , , , , , .

+3

, jQuery . , .

, .

+2

, .

, , , , . , O(n^3), , , JavaScript .

+1

jQuery , - . , , . , . , javaScript, , ajax-, jQuery, .

UPDATE . , javascript for vs jQuery $.each. jQuery 4 . jQuery 11ms vs javaScript 14ms

var array = new Array();
for (var i = 0; i < 10000; i++) {
    array[i] = 0;
}

console.time('native');
var l = array.length;
for (var i = 0; i < l; i++) {
    array[i] = i;
}
console.timeEnd('native');

console.time('jquery');
$.each(array,
function(i) {
    array[i] = i;
});
console.timeEnd('jquery');
0

Source: https://habr.com/ru/post/1795679/


All Articles