Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
cycle vs regex
(version: 0)
Comparing performance of:
cycle eng_str vs cycle rus_str vs regex eng_str vs regex rus_str
Created:
8 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
function is_only_eng_letters_and_digits(str) { for (let index = 0; index < str.length; index++) { const code = str.charCodeAt(index); if (!(code >= 65 && code <= 90) && !(code >= 97 && code <= 122) && !(code >= 48 && code <= 57)) { return false; } } return true; } var eng_str = "qwerty123"; var rus_str = "qwertyФЫВА123";
Tests:
cycle eng_str
for (let index = 0; index < 100000; index++) { for (let i = 0; i < eng_str.length; i++) { const code = str.charCodeAt(i); if (!(code >= 65 && code <= 90) && !(code >= 97 && code <= 122) && !(code >= 48 && code <= 57)) { break; } } }
cycle rus_str
for (let index = 0; index < 100000; index++) { for (let i = 0; i < eng_str.length; i++) { const code = str.charCodeAt(i); if (!(code >= 65 && code <= 90) && !(code >= 97 && code <= 122) && !(code >= 48 && code <= 57)) { break; } } }
regex eng_str
for (let index = 0; index < 100000; index++) { /^[A-Z0-9]+$/i.test(eng_str); }
regex rus_str
for (let index = 0; index < 100000; index++) { /^[A-Z0-9]+$/i.test(rus_str); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
cycle eng_str
cycle rus_str
regex eng_str
regex rus_str
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
cycle vs regex
cycle vs regex
Alphanumeric String
alpha-numeric string
Comments
Confirm delete:
Do you really want to delete benchmark?