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
If you can choose between a .pop() or .shift() on a Array, what would be a wise decision?
As my http://jsperf.com/adding-items-array/6 test shows the unshift is awful for performance. The same counts for .shift(), awful performance.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Auto Link Maker</title>
</head>
<body>
<a href=" https://itunes.apple.com/us/app/inet-network-scanner/id340793353?at=10lmJ8" target="itunes_store"> inet-network-scanner</a>
<footer>
<script type='text/javascript'>var _merchantSettings=_merchantSettings || [];_merchantSettings.push(['AT', '10lmJ8']);(function(){var autolink=document.createElement('script');autolink.type='text/javascript';autolink.async=true; autolink.src='https://autolinkmaker.itunes.apple.com/js/itunes_autolinkmaker.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(autolink, s);})();</script>
</footer>
</body>
</html>
Ready to run.
Test | Ops/sec | |
---|---|---|
.pop() |
| ready |
.shift() |
| ready |
.splice beginning |
| ready |
.splice end |
| ready |
Decrement .length |
| ready |
Reverse |
| ready |
unshift |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.