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 iterations = 100000;
function uncached(row, column) {
'use strict';
var base = '';
row += 1;
do {
let character = column % 26;
column -= character;
column /= 26;
base = String.fromCharCode(character + 65) + base;
} while (column);
return base + row;
}
var cache = {};
function cached(row, column) {
'use strict';
if (row in cache && column in cache[row]) return cache[row][column];
var base = '';
row += 1;
do {
let character = column % 26;
column -= character;
column /= 26;
base = String.fromCharCode(character + 65) + base;
} while (column);
var output = base + row;
if (!(row in cache)) cache[row] = {};
cache[row][column] = output;
return output;
}
var flatcache = {};
function flatcached(row, column) {
'use strict';
var id = row.toString() + '_' + column.toString()
if (id in flatcache) return flatcache[id];
var base = '';
row += 1;
do {
let character = column % 26;
column -= character;
column /= 26;
base = String.fromCharCode(character + 65) + base;
} while (column);
var output = base + row;
flatcache[id] = output;
return output;
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Uncached |
| ready |
Cached |
| ready |
Flat Cached |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.