Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Javascript: Case insensitive string comparison indexOf vs includes 2
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 27_0_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/150.0.7871.113 Mobile/15E148 Safari/604.1
Browser:
Chrome Mobile iOS 150
Operating system:
iOS 27.0.0
Device Platform:
Mobile
Date tested:
22 days ago
Regex_indexOf
264K/s
toLowerCase_includes
34K/s
View exact numbers
Test name
Executions per second
✓
Regex_indexOf
263,919 Ops/sec
toLowerCase_includes
34,013 Ops/sec
Script Preparation code:
var words = Array.from({ length: 1000 }, (_, i) => `word${i + 1}`); var searchString = "WORD512"; var searchStringRegex = new RegExp(searchString, 'i');
Tests:
toLowerCase_includes
const filteredCase1 = words.filter(word => word.toLowerCase().includes(searchString.toLowerCase()));
Regex_indexOf
const filteredCase2 = words.filter(word => searchStringRegex.test(word));