jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
http://jsfiddle.net/molokoloco/HhnZL/
http://kangax.github.com/es5-compat-table/ : Object.keys()
There an other difference between this function : $.map() et Object.keys() do a test and don't give back own Object properties :
var dimensions = {width: 10, height: 15}; var arr1 = $.map(dimensions, function(value, index) { return index; }); console.log(arr1); //> ["width", "height"] Object.prototype.properties = function() { var p = []; for (var k in this) p.push(k); return p; }; arr2 = dimensions.properties(); console.log(arr2); //> ["width", "height", "properties"]
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
var dimensions = {};
for (var i = 0; i < 1000; i++) dimensions[i] = i;
Object.prototype.properties = function() {
var p = [];
for (var k in this) p.push(k);
return p;
};
var properties = function(obj) {
var p = [];
for (var k in obj) p.push(k);
return p;
};
Ready to run.
Test | Ops/sec | |
---|---|---|
$.map(dimensions, function(){}) |
| ready |
Object.prototype.properties |
| ready |
var properties = function(obj) |
| ready |
Object.keys(dimensions) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.