HTML Preparation code:
Script Preparation code:
Tests:

Historical Performance Data aggregated from 7 community runs

Desktop Results:
Chrome 7 runs
Node.contains()
5.7M/s
document.contains
3.9M/s

Fastest: Node.contains() (1.5x faster)

View exact numbers
  • Node.contains(): 5,730,338 ops/sec
  • document.contains: 3,938,189 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
    document.contains
    Node.contains()

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:137.0) Gecko/20100101 Firefox/137.0
Firefox 137 on Ubuntu
View result in a separate tab
Node.contains()
5.6M/s
document.contains
5.1M/s
View exact numbers
Test name Executions per second
Node.contains() 5,624,465 Ops/sec
document.contains 5,116,217 Ops/sec