Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Jump vs switch case
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 138
Operating system:
Android
Device Platform:
Mobile
Date tested:
10 months ago
Test name
Executions per second
switch case
1640.3 Ops/sec
jump table
304.2 Ops/sec
Tests:
switch case
function thing(j) { switch(j) { case 0: return "rah"; case 1: return "lah"; case 2: return "sah"; case 3: return "blah"; } } for(let i = 0; i < 100000; i++) { for(let j = 0; thing(j) != "blah"; j++) { } }
jump table
function rah() { return "rah"; } function lah() { return "lah"; } function sah() { return "sah"; } function blah() { return "blah"; } let jumpTable = [rah, lah, sah, blah]; for(let i = 0; i < 100000; i++) { for(let j = 0; jumpTable[j]() != "blah"; j++) { } }