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
Which way to sort collection is faster?
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.0/backbone-min.js"></script>
var collection = new Backbone.Collection(),
order = new Array(100000),
models = [];
_.each(order, function (item, index) {
models.push({
order: (item % 2 === 0) ? 2 : 1,
index: index
});
});
Ready to run.
Test | Ops/sec | |
---|---|---|
Sort attribute |
| ready |
Sort function |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.