Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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
Benchmark engine:
Benchmark.js
index single
111.8M/s
endsWith single
102.6M/s
index multiple
82.2M/s
endsWith multiple
67.7M/s
View exact numbers
Test name
Executions per second
✓
index single
111,797,072 Ops/sec
endsWith single
102,641,416 Ops/sec
index multiple
82,183,712 Ops/sec
endsWith multiple
67,719,304 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'