Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Compare string refactor case sensitive
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/121.0.0.0 Safari/537.36
Browser:
Chrome 121
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
without lowercase function
159893.6 Ops/sec
with lowercase function comp
145468.0 Ops/sec
Script Preparation code:
var wordList1 = ['apple', 'banana', 'orange', 'kiwi', 'grape', 'APPLE', 'BaNaNa', 'ORAnge', 'kiWI', 'GRapE']; var wordList2 = ['kiwi', 'orange', 'banana', 'grape', 'apple'];
Tests:
without lowercase function
function stringCompare(lowerA, lowerB) { if (lowerA < lowerB) { return -1; } if (lowerA > lowerB) { return 1; } return 0; } for (let i = 0; i < wordList1.length; i++) { for (let j = 0; j < wordList2.length; j++) { stringCompare(wordList1[i], wordList2[j]); } }
with lowercase function comp
function stringCompare(a, b) { const lowerA = a.toLowerCase(); const lowerB = b.toLowerCase(); if (lowerA < lowerB) { return -1; } if (lowerA > lowerB) { return 1; } return 0; } for (let i = 0; i < wordList1.length; i++) { for (let j = 0; j < wordList2.length; j++) { stringCompare(wordList1[i], wordList2[j]); } }