Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
testConcat
(version: 3)
Comparing performance of:
caso 1 vs caso nacho vs caso pablo vs caso anto
Created:
5 years ago
by:
Registered User
Jump to the latest result
Tests:
caso 1
let a = [10,2]; function concatSumA(a) { let result = 0; const arrLength = a.length; a.forEach(numA => { a.forEach(numB => { result += (numA * Math.pow(10, Math.log(numB) * Math.LOG10E + 1 | 0)) + numB; }); }); return result; } concatSumA(a);
caso nacho
let a = [10,2]; function concatSumA(a) { let result = 0; for(let i = 0; i < a.length; i++) { for(let j=0; j < a.length; j++) { result += parseInt(a[i].toString()+ a[j].toString(), 10); } } console.log(result); } concatSumA(a);
caso pablo
let a = [10,2]; function concatSumB(a) { let result = 0; const arrLength = a.length; a.forEach(elementA => { a.forEach(elementB => { result += parseInt([elementA, elementB].join(''), 10); }); }); return result; } concatSumB(a);
caso anto
let a = [10,2]; function concatSumA(array) { let result = [].concat(...array.map( (v, i) => array.map( w => v.toString() + w )) ); return result.reduce((a, b) => parseInt(a) + parseInt(b)); } concatSumA(a);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
caso 1
caso nacho
caso pablo
caso anto
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!
Related benchmarks:
concatvsnoconcat
string_concat_19oq287398127398127398123
Concat vs Spread asdasdasdasdada
concat vs const
Concat / Spread
Comments
Confirm delete:
Do you really want to delete benchmark?