new RegExp() vs Literal vs new RegExp(Literal)Fastest: new RegExp() (1.7x faster)
13,313,497 ops/sec
13,259,180 ops/sec
7,619,812 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| new RegExp() | |
| Literal | |
| new RegExp(Literal) |
| Test name | Executions per second |
|---|---|
| ✓ Literal | 18,518,956 Ops/sec |
| new RegExp() | 16,403,342 Ops/sec |
| new RegExp(Literal) | 13,391,357 Ops/sec |