Instruction Decode (v3)

Revision 3 of this benchmark created on


Setup

opcode = Math.random() * 2 ** 31;
const instructionSizeTable = [3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 4, 3];
const instructionSizeTableUint = new Uint8Array(instructionSizeTable);

Test runner

Ready to run.

Testing in
TestOps/sec
Lookup table
const size = instructionSizeTable[opcode & 0xf]; 
ready
Bitwise
    const size =  (opcode & 0xf) === 0xe ? 4 : (opcode & 0xc) === 0x8 || ((opcode & 0xc) === 0xc && (opcode & 0x2) === 0) ? 2 : 3; 


ready
Lookup table (Uint8Array)
const size = instructionSizeTableUint [opcode & 0xf]; 
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.