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
Bitshift to convert to number
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
if ($.browser.msie) {
var superParseInt = function(a) {
return ~~a;
};
} else {
var superParseInt = function(a) {
a = parseInt(a, 10);
a = isNaN(a) ? 0 : a;
}
}
</script>
var i = '1561565', j;
Ready to run.
Test | Ops/sec | |
---|---|---|
Double Tilde |
| ready |
ParseInt |
| ready |
Plus sign |
| ready |
Times 1 |
| ready |
Best of both worlds? |
| ready |
Bitshift |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.