Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
loop vs indexof
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0
Browser:
Firefox 80
Operating system:
Windows 7
Device Platform:
Desktop
Date tested:
one year ago
loop
10.5M/s
indeOf
1.2M/s
View exact numbers
Test name
Executions per second
✓
loop
10,464,199 Ops/sec
indeOf
1,171,180 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
let str = ""; for (let a = 0; a < 16384; a++) { str += "a"; } str += "test"; for (let a = 0; a < 16384; a++) { str += "a"; } let len=str.length; let index=0; let found=false;
Tests:
indeOf
let asd=str.indexOf("test");
loop
do{ if(str.charAt(index)=="t") { found=true; } index++; }while(index<len && found==false)