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
Deep copy/extend objects, jQuery versus other approach(es)
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
/*!
* Copyright Andrée Hansson, 2010
* Use it however you want, attribution would be nice though.
*
* GMail/Twitter: peolanha
* IRC (FreeNode): peol
* Website: http://andreehansson.se/
*/
/* update 4: Leonardo Dutra
* twitter.com/leodutra
*/
deepCopyObject = function(superObj, extension) {
if (superObj && extension) {
var deep = function() {}; // prepare sword
deep.prototype = superObj; // hold it
superObj = new deep; // pull it
return (deep = function(o, ext) { // concentrate
var k;
for (k in ext) {
o[k] = typeof ext[k] === 'object' && ext[k] ? deep({}, ext[k]) : ext[k];
}
return o;
})(superObj, extension); // push it deep, slicing
}
return null;
};
var a = { // don't forget the breath
a: '1',
b: {
a: '1',
b: [{
a: '1'
},
{
b: '1'
},
{
c: '1'
},
{
d: '1'
}]
}
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
jQuery |
| ready |
Other |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.