Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
+ '' vs .toString() v3 rand numbers
(version: 0)
Comparing performance of:
testToString vs testToStringCoercion
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
const data = Array.from({ length: 1000 }, () => Math.random()); console.log(data) function testToString(val) { return val.toString(); } function testToStringCoercion(val) { return val + ""; }
Tests:
testToString
let nums = []; for(let i = 0; i < 100; ++i) { data.forEach(function (input) { nums.push(testToString(input)); }) }
testToStringCoercion
let nums = []; for(let i = 0; i < 100; ++i) { data.forEach(function (input) { nums.push(testToStringCoercion(input)); }) }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
testToString
testToStringCoercion
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?