HTML Preparation code:
Tests:

Historical Performance Data aggregated from 16 community runs

Desktop Results:
Chrome 11 runs
Sanitize HTML
80K/s
DOMPurify
21K/s

Fastest: Sanitize HTML (3.8x faster)

View exact numbers
  • Sanitize HTML: 79,596 ops/sec
  • DOMPurify: 20,918 ops/sec
Firefox 5 runs
Sanitize HTML
56K/s
DOMPurify
12K/s

Fastest: Sanitize HTML (4.7x faster)

View exact numbers
  • Sanitize HTML: 56,404 ops/sec
  • DOMPurify: 12,016 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: 3 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 Edg/146.0.0.0
Chrome 146 on Windows
View result in a separate tab
Sanitize HTML
80K/s
DOMPurify
18K/s
View exact numbers
Test name Executions per second
Sanitize HTML 79,596 Ops/sec
DOMPurify 17,904 Ops/sec