HTML Preparation code:
Tests:

Historical Performance Data aggregated from 9 community runs

Desktop Results:
Chrome 9 runs
DOMPurify
164K/s
Sanitize HTML
22K/s

Fastest: DOMPurify (7.6x faster)

View exact numbers
  • DOMPurify: 164,021 ops/sec
  • Sanitize HTML: 21,638 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
    Sanitize HTML

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Chrome 135 on Windows
View result in a separate tab
DOMPurify
238K/s
Sanitize HTML
32K/s
View exact numbers
Test name Executions per second
DOMPurify 237,769 Ops/sec
Sanitize HTML 31,575 Ops/sec