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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0
Browser:
Chrome 120
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
endsWith single
15.8M/s
endsWith multiple
15.4M/s
index single
10.4M/s
index multiple
2.9M/s
View exact numbers
Test name
Executions per second
✓
endsWith single
15,814,737 Ops/sec
endsWith multiple
15,385,623 Ops/sec
index single
10,401,107 Ops/sec
index multiple
2,929,773 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'