Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
endsWith vs index
Checks endsWith vs index
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser:
Chrome 135
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
endsWith multiple
67719304.0 Ops/sec
index multiple
82183712.0 Ops/sec
endsWith single
102641416.0 Ops/sec
index single
111797072.0 Ops/sec
Script Preparation code:
var a="this is a very long string"
Tests:
endsWith multiple
const b = a.endsWith("ring")
index multiple
const b= a[a.length-4]==='r'&&a[a.length-3]==='i'&&a[a.length-2]==='n'&&a[a.length-1]==='g'
endsWith single
const b = a.endsWith("g")
index single
const b= a[a.length-1]==='g'