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
To generate a slug, do this:
-
)Note that following these steps still won’t turn "ïñtërnâtiônàlizætiøn"
into "internationalization"
. This was not a requirement in this case.
<script>
var t='';
var arr = [
'This is just a test', // → "this-is-just-a-test"
'Some “weird” characters: ©™® Awesome', // → "some-weird-characters-awesome"
'Lorem ipsum 123 dolor' // → "lorem-ipsum-123-dolor"
];
function charloop(str) {
str = str.toLocaleLowerCase();
var L=str.length;
var ar='';
var j;
var c;
var z = false;
for(j=0;j<L;j++){
c=str.charCodeAt(j);
if((c>=48&&c<=57)
||
(
c >= 97
&&c <= 122
)
){
ar += str[j];
z = false;
}
else if (z === false) {
ar += '-';
z = true;
}
}
return ar
}
function severalreplace(str){
return str.toLowerCase().replace(/[^a-z0-9-]+/g, '-').replace(/[-]+/g, '-').replace(/^-|-$/g, '');
}
function matchjoin(str){
return str.toLowerCase().match(/[a-z0-9]+/ig).join('-');
}
</script>
t='';
t='';
Ready to run.
Test | Ops/sec | |
---|---|---|
several replace |
| ready |
matchjoin |
| ready |
char loop |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.