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:
5 months ago
by:
Guest
Jump 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:
5 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
Test name
Executions per second
instantiate new regex
20874326.0 Ops/sec
use existing regex
21752466.0 Ops/sec
Related benchmarks:
regexp n such
regex vs length
test regex vs loop
Regexp comparisions
Regex vs Forloop Performance
Regex whitespace vs manual checking
RegEx.test vs. String.includes vs. for
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?