HTML Preparation code:
Script Preparation code:
Tests:

Historical Performance Data aggregated from 19 community runs

Desktop Results:
Chrome 12 runs
HtmlSanitizer
28K/s
DOMPurify
11K/s

Fastest: HtmlSanitizer (2.5x faster)

View exact numbers
  • HtmlSanitizer: 27,568 ops/sec
  • DOMPurify: 11,237 ops/sec
Firefox 7 runs
HtmlSanitizer
22K/s
DOMPurify
6K/s

Fastest: HtmlSanitizer (3.7x faster)

View exact numbers
  • HtmlSanitizer: 21,815 ops/sec
  • DOMPurify: 5,869 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
    HtmlSanitizer
    DOMPurify

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 months ago)
Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0
Firefox 140 on Linux
View result in a separate tab
HtmlSanitizer
5K/s
DOMPurify
2K/s
View exact numbers
Test name Executions per second
HtmlSanitizer 5,121 Ops/sec
DOMPurify 1,790 Ops/sec