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 a = new Int8Array(9);
var b = 0;
var isTerminal = function(B) {
if (((B[0] === B[1+3*1]) && (B[0] === B[2 + 3*2])) ||
((B[0 + 2*3] === B[1 + 3*1]) && (B[0 + 3*2] === B[2 + 3*0]))) {
if (B[1 + 3*1] !== 0)
return B[1+ 3*1];
}
for (var i = 3 - 1; i >= 0; i--) {
if ((B[i + 3*0] === B[i + 3*1]) && (B[i + 3*0] === B[i + 3*2])) {
if (B[i + 3*0] !== 0)
return B[i + 3*0];
}
if ((B[0 + 3*i] === B[1 + 3*i]) && (B[0 + 3*i] === B[2 + 3*i])) {
if (B[0 + 3*i] !== 0)
return B[0 + 3*i];
}
}
return 0;
};
var board2Bin = function(p, r, c) {
var board = 0;
for (var i = r.length - 1; i >= 0; i--){
board = board | p << (r[i] + c[i]*3) * 2;
};
return board;
};
winningBoards = [
board2Bin(1, [0, 1, 2], [0, 0, 0]),
board2Bin(1, [0, 1, 2], [1, 1, 1]),
board2Bin(1, [0, 1, 2], [2, 2, 2]),
board2Bin(1, [0, 1, 2], [0, 1, 2]),
board2Bin(1, [0, 1, 2], [2, 1, 0]),
board2Bin(1, [0, 0, 0], [0, 1, 2]),
board2Bin(1, [1, 1, 1], [0, 1, 2]),
board2Bin(1, [2, 2, 2], [0, 1, 2])
];
var isTerminal2 = function(B){
return (B & winningBoards[0] === winningBoards[0]) | (B & winningBoards[1] === winningBoards[1]) | (B & winningBoards[2] === winningBoards[2]) | (B & winningBoards[3] === winningBoards[3]) | (B & winningBoards[4] === winningBoards[4]) | (B & winningBoards[5] === winningBoards[5]) | (B & winningBoards[6] === winningBoards[6]) | (B & winningBoards[7] === winningBoards[7]);
};
Ready to run.
Test | Ops/sec | |
---|---|---|
int8array |
| ready |
bitop |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.