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
"use strict";
var fastuid = () => ("00000" + (Math.random()*Math.pow(36,5) << 0).toString(36)).slice(-5);
var fastuid2a = () =>fastuid()+fastuid()+fastuid()+fastuid();
var fastuid2b = () =>Array.apply(null, Array(4)).map(String.prototype.valueOf,("00000" + (Math.random()*Math.pow(36,5) << 0).toString(36)).slice(-5)).join();
var fastuid3 = ()=>(1e20+'').replace(/[018]/g,a=>(a^Math.random()*16>>a/4).toString(16));
var fastuidBis = () => {var fn = () => (Math.random()*Math.pow(36,5) << 0).toString(36); return ("0000000000" + fn()+fn()).slice(-10);}
var fastuidLong = (a) => {let n = '';var fn1 = (a) => {let n='';while (a--) {n+='00000'};return n}; var fn2 = (a) => {let n='';while (a--) {n+=(Math.random()*Math.pow(36,5) << 0).toString(36)};return n}; return (fn1(a)+fn2(a)).slice(a*5);}
/* v2 */
var fastuidLongv2 = (a) => {let s = '';((a) => {while (a--) {s+='00000'}})(a); ((a) => {while (a--) {s+=(Math.random()*Math.pow(36,5) << 0).toString(36)}})(a); return (s).slice(a*5);}
Ready to run.
Test | Ops/sec | |
---|---|---|
fastuid2a() |
| ready |
fastuid3() |
| ready |
fastuid2b() |
| ready |
fastuidBis() |
| ready |
fastuidLong() |
| ready |
fastuidLong(a lot) |
| ready |
fastuidLongv2() |
| ready |
fastuidLongv2(a lot) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.