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
http://stackoverflow.com/questions/7538590/which-is-better-more-efficient-in-coffeescript-when-running-a-for-loop
<script>
var iterIndices, iterString;
iterIndices = function(str) {
var i, s, _ref;
s = 0;
for (i = 0, _ref = str.length; 0 <= _ref ? i < _ref : i > _ref; 0 <= _ref ? i++ : i--) {
s += str.charCodeAt(i);
}
return s;
};
iterString = function(str) {
var i, s, _i, _len;
s = 0;
for (_i = 0, _len = str.length; _i < _len; _i++) {
i = str[_i];
s += i.charCodeAt(0);
}
return s;
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Iterate indices |
| ready |
Iterate string |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.