Tests:
  • try-catch control flow (no exception)

    AخA
     
    const ok = true;
    let res;
    try {
      if (!ok) {
        throw new Error('ok = false');
      }
      
      res = 1 + 1;
    } catch (e) {
      res = 1 + 2;
    }
  • try-catch control flow (thrown exception)

     
    const ok = false;
    let res;
    try {
      if (!ok) {
        throw new Error('ok = false');
      }
      
      res = 1 + 1;
    } catch (e) {
      res = 1 + 2;
    }
  • if-else (hits if)

     
    const ok = true;
    let res;
    if (ok) {
        res = 1 + 1;
    } else {
        res = 1 + 2;
    }
  • if-else (hits else)

     
    const ok = false;
    let res;
    if (ok) {
        res = 1 + 1;
    } else {
        res = 1 + 2;
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    try-catch control flow (no exception)
    try-catch control flow (thrown exception)
    if-else (hits if)
    if-else (hits else)

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 22 hours ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Chrome 132 on Linux
View result in a separate tab
Test name Executions per second
try-catch control flow (no exception) 112155504.0 Ops/sec
try-catch control flow (thrown exception) 189011.0 Ops/sec
if-else (hits if) 112710192.0 Ops/sec
if-else (hits else) 115344648.0 Ops/sec