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
<script src="https://rawgit.com/megawac/underscore/slice/underscore.js"></script>
var set = _.range(30);
var holedset = Array(30);
for (var i = 0; i < 5; i++) {
holedset[i * 6] = i;
}
function protoSlice(set, i) {
return set.slice(i);
};
var slice = Array.prototype.slice;
function callSlice(set, i) {
return slice.call(set, i);
}
_.simpleSlice = function(collection, start, end) {
var length = collection.length;
if (start == null || !+start) start = 0;
else if (start < 0) start += -start > length ? -start : length;
if (end == null || end > length) end = length;
else if (!+end) end = 0;
else if (end < 0) end += length;
length = end < start ? 0 : end - start;
var result = Array(length);
for (var i = 0; i < length; i++) result[i] = collection[i + start];
return result;
};
Ready to run.
Test | Ops/sec | |
---|---|---|
slice (prototype) |
| ready |
slice (call) |
| ready |
slice (megawac) |
| ready |
slice (simple) |
| ready |
slice (holes, prototype) |
| ready |
slice (holes, call) |
| ready |
slice (holes, megawac) |
| ready |
slice (holes, simple) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.