Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
how fast is regex?
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 9; VTR-L09 Build/HUAWEIVTR-L09; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/85.0.4183.101 Mobile Safari/537.36
Browser:
Chrome Mobile 85
Operating system:
Android
Device Platform:
Mobile
Date tested:
6 months ago
Test name
Executions per second
instantiate new regex
1063700.9 Ops/sec
use existing regex
1102662.8 Ops/sec
Script Preparation code:
const prepared = /[.*+?^${}()|[\]\\]/g;
Tests:
instantiate new regex
const blah = "whatever" const r = blah.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
use existing regex
const blah = "whatever" const r = blah.replace(prepared, "\\$&")