jQuery’de yaptığımız işlemlerin daha performanslı çalışması için farklı farklı yöntemler bulunmakta. Bende bu yöntemlerden bir tanesini sizlere göstereceğim.
Ayrıca birçok performans testi için;
http://jsperf.com/browse
Örnek;
// 136ms
console.time('test');
for ( i = 1; i <= 1000; i++ ){
$('.box').text(i);
}
console.timeEnd('test');
// 99ms
console.time('test_cache');
var box = $('.box');
for ( i = 1; i <= 1000; i++ ){
box.text(i);
}
console.timeEnd('test_cache');