Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
concat, etc
(version: 0)
Comparing performance of:
push vs counter-join vs counter-repeat
Created:
8 years ago
by:
Guest
Jump to the latest result
Tests:
push
let myObject = { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e', f: 'f', g: 'g', h: 'h', j: 'j', i: 'i' }; const keys = Object.keys(myObject); let operationCount = 200000; while (operationCount--) { let placeholders = ['?', '?', '?']; for (const k of keys) placeholders.push('?'); const sql = placeholders.join(','); }
counter-join
let myObject = { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e', f: 'f', g: 'g', h: 'h', j: 'j', i: 'i' }; const keys = Object.keys(myObject); let operationCount = 200000; while (operationCount--) { let placeholderCounter = 0; for (const k of keys) placeholderCounter++; const sql = (new Array(placeholderCounter + 3)).fill('?').join('?'); }
counter-repeat
let myObject = { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e', f: 'f', g: 'g', h: 'h', j: 'j', i: 'i' }; const keys = Object.keys(myObject); let operationCount = 200000; while (operationCount--) { let placeholderCounter = 0; for (const k of keys) placeholderCounter++; const sql = '?' + ',?'.repeat(placeholderCounter + 2); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
push
counter-join
counter-repeat
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:
test concat vs spread+push
arra vs concat1231324
EGO concat vs spread Small Array
string concat: concat vs +
Native JS: concatenate string with + vs template literals vs String.concat2
Comments
Confirm delete:
Do you really want to delete benchmark?