Hello everyone, I made an alternative to jquery and was testing it against jquery for performance. I also wanted to test the most optimized jquery selectors and ended up in jquery's Optimize Selectors page. However, when testing it in Phantom JS (based on webkit), this doesn't seem to hold true:
$( ".buttons > *" ); // Extremely expensive.
$( ".buttons" ).children(); // Much better.
The first one seems to be faster for my situation. This is the test that should fail if jquery's page is true:
it("jquery vs jquery: mistake?", function() {
var aTime = performance(function(){
$(".ro > *");
}, 100);
var bTime = performance(function(){
$(".ro").children();
}, 100);
console.log('a: ' + aTime + 'ms ', 'b: ' + bTime + 'ms');
expect(aTime).to.be.below(bTime, uTime + ' ms');
});
However the test passes and in the terminal it's printed:
In the browser, the test also passes and it's "wrong":
So, was it an optimization for a previous version? is it a wrong optimization? Or it's just that it depends on the situation? (therefore, it's wrong stating it as an optimization)
Hello everyone, I made an alternative to jquery and was testing it against jquery for performance. I also wanted to test the most optimized jquery selectors and ended up in jquery's Optimize Selectors page. However, when testing it in Phantom JS (based on webkit), this doesn't seem to hold true:
The first one seems to be faster for my situation. This is the test that should fail if jquery's page is true:
However the test passes and in the terminal it's printed:
In the browser, the test also passes and it's "wrong":
So, was it an optimization for a previous version? is it a wrong optimization? Or it's just that it depends on the situation? (therefore, it's wrong stating it as an optimization)