Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
RegEx Length vs String Length
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser:
Chrome 132
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
For Loop
2.9M/s
RegEx
2.0M/s
View exact numbers
Test name
Executions per second
✓
For Loop
2,913,169 Ops/sec
RegEx
2,036,226 Ops/sec
Script Preparation code:
var string = '1b3d5f7'; var valid = false;
Tests:
RegEx
valid = /.{8,}/.test(string);
For Loop
valid = true; if (string.length < 8) { valid = false; }