HTML Preparation code:
Tests:

Historical Performance Data aggregated from 5 community runs

Desktop Results:
Chrome 5 runs
Sanitize HTML
217.2M/s
DOMPurify without IN_PLACE
15K/s
DOMPurify with IN_PLACE
14K/s

Fastest: Sanitize HTML (15530.0x faster)

View exact numbers
  • Sanitize HTML: 217,193,584 ops/sec
  • DOMPurify without IN_PLACE: 14,503 ops/sec
  • DOMPurify with IN_PLACE: 13,985 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
    DOMPurify with IN_PLACE
    Sanitize HTML
    DOMPurify without IN_PLACE

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (iPhone; CPU iPhone OS 18_3_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3.1 Mobile/15E148 Safari/604.1
Mobile Safari 18 on iOS 18.3.2
View result in a separate tab
Sanitize HTML
478.8M/s
DOMPurify with IN_PLACE
39K/s
DOMPurify without IN_PLACE
38K/s
View exact numbers
Test name Executions per second
Sanitize HTML 478,799,456 Ops/sec
DOMPurify with IN_PLACE 39,073 Ops/sec
DOMPurify without IN_PLACE 38,070 Ops/sec