Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
AlgoBenchmark
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/136.0.0.0 Safari/537.36
Browser:
Chrome 136
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Concat
2.5 Ops/sec
Join Array
3.5 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
let arr = Array.from({ length: 1_000_000 }, () => 'XmlHttpRequest');
Tests:
Concat
function camelToSnake(text) { // your code here let result = ''; for (let i = 0; i < text.length; i++) { const char = text[i]; if (char.toUpperCase() === char) { if (i !== 0) { result += '_'; } result += char.toLowerCase(); } else { result += char; } } return result; } return arr.map(camelToSnake);
Join Array
function camelToSnake(text) { if (text.length === 0) { return text; } let result = [text[0].toLowerCase()]; for (let i = 1; i < text.length; i++) { if (text[i] === text[i].toLowerCase()) { result.push(text[i]); continue; } result.push(`_${text[i].toLowerCase()}`); } return result.join(''); } return arr.map(camelToSnake);