Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Split vs substring with concat
References string parts to test hidden performance optimizations between the two implementations by not throwing away the results of the operation.
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/124.0.0.0 Safari/537.36
Browser:
Chrome 124
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Split and concat
41514208.0 Ops/sec
Substring and concat
175403952.0 Ops/sec
Tests:
Split and concat
const email = 'some.long.email.addr@example.org'; const [part1, part2] = email.split('@'); const joined = part1 + '@' + part2
Substring and concat
const email = 'some.long.email.addr@example.org'; const part1 = email.substring(0, email.indexOf('@')); const part2 = email.substring(email.indexOf('@') + 1); const joined = part1 + '@' + part2;