Tests:
  • ==

    AخA
     
    for (let a = 0; a < 1_000_000; a++) {
        a == 1;
    }
  • ===

     
    for (let a = 0; a < 1_000_000; a++) {
        a === 1;
    }
  • == str

     
    for (let a = 0; a < 1_000_000; a++) {
        a == '1';
    }
  • === str

     
    for (let a = 0; a < 1_000_000; a++) {
        a === '1';
    }
  • == true

     
    for (let a = 0; a < 1_000_000; a++) {
        a == true;
    }
  • == null

     
    for (let a = 0; a < 1_000_000; a++) {
        a == null;
    }
  • === null

     
    for (let a = 0; a < 1_000_000; a++) {
        a === null;
    }
  • === true

     
    for (let a = 0; a < 1_000_000; a++) {
        a === true;
    }
  • == str with str

     
    for (let a = 0, b = ''; a < 1_000_000; a++) {
        b == '0';
    }
  • === str with str

     
    for (let a = 0, b = ''; a < 1_000_000; a++) {
        b === '0';
    }
  • == str with number

     
    for (let a = 0, b = ''; a < 1_000_000; a++) {
        b == 0;
    }
  • === str with number

     
    for (let a = 0, b = ''; a < 1_000_000; a++) {
        b === 0;
    }
  • obj to bool

     
    for (let a = 0, b = {}; a < 1_000_000; a++) {
        b == true;
    }
  • bool to bool

     
    for (let a = 0, b = false; a < 1_000_000; a++) {
        b == true;
    }
  • arr to bool

     
    for (let a = 0, b = []; a < 1_000_000; a++) {
        b == true;
    }
  • str to bool

     
    for (let a = 0, b = ''; a < 1_000_000; a++) {
        b == true;
    }
  • null to bool

     
    for (let a = 0, b = null; a < 1_000_000; a++) {
        b == true;
    }
  • null == undefined

     
    for (let a = 0, b = null; a < 1_000_000; a++) {
        b == undefined;
    }
  • undefined == null

     
    for (let a = 0, b = undefined; a < 1_000_000; a++) {
        b == null;
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    ==
    ===
    == str
    === str
    == true
    == null
    === null
    === true
    == str with str
    === str with str
    == str with number
    === str with number
    obj to bool
    bool to bool
    arr to bool
    str to bool
    null to bool
    null == undefined
    undefined == null

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36
Chrome 87 on Windows
View result in a separate tab
Test name Executions per second
== 3692.1 Ops/sec
null to bool 3696.0 Ops/sec
str to bool 31.6 Ops/sec
arr to bool 5.0 Ops/sec
bool to bool 3658.8 Ops/sec
obj to bool 10.2 Ops/sec
=== str with number 3695.1 Ops/sec
== str with number 34.1 Ops/sec
null == undefined 5.9 Ops/sec
=== str with str 3697.0 Ops/sec
=== true 3681.8 Ops/sec
=== null 3673.7 Ops/sec
== null 3677.1 Ops/sec
== true 3685.6 Ops/sec
=== str 3675.9 Ops/sec
== str 135.8 Ops/sec
=== 3678.2 Ops/sec
== str with str 3670.9 Ops/sec
undefined == null 1837.5 Ops/sec