Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
how fast is regex IP?
(version: 1)
Comparing performance of:
instantiate new regex vs use existing regex
Created:
9 months ago
by:
Guest
Go to the latest result
Script Preparation code:
const prepared = /[0-9]{1,3}(\.[0-9]{1,3}){3,3}|([0-9a-f]{1,4}:{1,2}){1,7}[0-9a-f]{1,4}/gi;
Tests:
instantiate new regex
const ipstring = "43.193.33.82"; const r = ipstring.match(/[0-9]{1,3}(\.[0-9]{1,3}){3,3}|([0-9a-f]{1,4}:{1,2}){1,7}[0-9a-f]{1,4}/gi)
use existing regex
const ipstring = "43.193.33.82"; const r = ipstring.match(prepared)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
instantiate new regex
use existing regex
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
9 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0
Browser/OS:
Chrome 142 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
use existing regex
21.8M/s
instantiate new regex
20.9M/s
View exact numbers
Test name
Executions per second
✓
use existing regex
21,752,466 Ops/sec
instantiate new regex
20,874,326 Ops/sec
Related benchmarks
test regex vs loop
Regex vs Forloop Performance
Regex whitespace vs manual checking
includes vs indexOf vs findIndex vs Regex
.startsWith() vs. RegExp for short strings and short prefixes
Comments
Confirm delete:
Do you really want to delete benchmark?