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
var s1 = "first";
var s2 = "second";
var s3 = 'helloa';
var s4 = 'hello';
var s5 = 'sup';
var s6 = 'sup';
var custom=function(s1,s2){
return s1 < s2 ? -1 : s1 > s2 ? 1 : 0;
}
var cmp = function (a, b) {
var a_length = a.length, b_length = b.length, min_length = Math.min(a_length, b_length), a_code, b_code;
for (var i = 0; i < min_length; i++) {
a_code = a.charCodeAt(i);
b_code = b.charCodeAt(i);
if (a_code < b_code) {
return -1;
}
else if (b_code < a_code) {
return 1;
}
}
if (a_length < b_length) {
return -1;
}
else if (b_length < a_length) {
return -1;
}
else {
return 0;
}
};
Ready to run.
Test | Ops/sec | |
---|---|---|
localeCompare |
| ready |
Custom |
| ready |
cmp |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.