HTML Preparation code:
Script Preparation code:
Tests:

Historical Performance Data aggregated from 42 community runs

Desktop Results:
Chrome 42 runs
string type
21.0M/s
instanceof
8.9M/s
constructor comparison
8.8M/s
property
8.3M/s
string type + undefined
8.3M/s

Fastest: string type (2.5x faster)

View exact numbers
  • string type: 21,013,596 ops/sec
  • instanceof: 8,854,780 ops/sec
  • constructor comparison: 8,835,674 ops/sec
  • property: 8,332,293 ops/sec
  • string type + undefined: 8,282,611 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    instanceof
    string type
    string type + undefined
    property
    constructor comparison

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 months ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
Chrome 145 on Mac OS X 10.15.7
View result in a separate tab
constructor comparison
184.7M/s
string type + undefined
184.6M/s
instanceof
182.0M/s
string type
180.6M/s
property
166.6M/s
View exact numbers
Test name Executions per second
constructor comparison 184,690,880 Ops/sec
string type + undefined 184,613,104 Ops/sec
instanceof 181,958,368 Ops/sec
string type 180,586,288 Ops/sec
property 166,633,696 Ops/sec