Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
drizzle mapping #01
(version: 0)
Comparing performance of:
reduce vs for
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var rows = [ ["Alef1", "alef1.bolk@gmail.com", 30, 40, 50], ["Alef2", "alef2.bolk@gmail.com", 30, 40, 50], ["Alef3", "alef3.bolk@gmail.com", 30, 40, 50], ["Alef1", "alef1.bolk@gmail.com", 30, 40, 50], ["Alef2", "alef2.bolk@gmail.com", 30, 40, 50], ["Alef3", "alef3.bolk@gmail.com", 30, 40, 50], ["Alef1", "alef1.bolk@gmail.com", 30, 40, 50], ["Alef2", "alef2.bolk@gmail.com", 30, 40, 50], ["Alef3", "alef3.bolk@gmail.com", 30, 40, 50], ["Alef1", "alef1.bolk@gmail.com", 30, 40, 50], ["Alef2", "alef2.bolk@gmail.com", 30, 40, 50], ["Alef3", "alef3.bolk@gmail.com", 30, 40, 50], ["Alef1", "alef1.bolk@gmail.com", 30, 40, 50], ["Alef2", "alef2.bolk@gmail.com", 30, 40, 50], ["Alef3", "alef3.bolk@gmail.com", 30, 40, 50], ] var maps = [ ["name", 0], ["email", 1], ["num1", 2], ["num2", 3], ["num3", 4], ];
Tests:
reduce
var result = rows.map((it) => { return maps.reduce((acc, [name, num]) => { acc[name] = it[num]; return acc; }, {} ); });
for
var result = [] for(var row of rows){ const node = {} for(var mapper of maps){ node[mapper[0]] = row[mapper[1]] } result.push(node) }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
reduce
for
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Android 11; Mobile; rv:136.0) Gecko/136.0 Firefox/136.0
Browser/OS:
Firefox Mobile 136 on Android
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
reduce
311090.0 Ops/sec
for
315742.2 Ops/sec
Comments
Confirm delete:
Do you really want to delete benchmark?