DOMParser vs createContextualFragment vs innerHTML vs insertAdjacentHTML vs createContextualFragment PolyFillFastest: DOMParser (1.2x faster)
612 ops/sec
542 ops/sec
514 ops/sec
513 ops/sec
512 ops/sec
Fastest: insertAdjacentHTML (1.3x faster)
862 ops/sec
846 ops/sec
779 ops/sec
764 ops/sec
672 ops/sec
Fastest: createContextualFragment (1.5x faster)
97 ops/sec
85 ops/sec
76 ops/sec
72 ops/sec
64 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| DOMParser | |
| createContextualFragment | |
| innerHTML | |
| insertAdjacentHTML | |
| createContextualFragment PolyFill |
| Test name | Executions per second |
|---|---|
| ✓ DOMParser | 1,147 Ops/sec |
| createContextualFragment | 1,132 Ops/sec |
| innerHTML | 1,098 Ops/sec |
| createContextualFragment PolyFill | 1,095 Ops/sec |
| insertAdjacentHTML | 1,074 Ops/sec |