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
Test name
Executions per second
indeOf
1171180.2 Ops/sec
loop
10464199.0 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)