Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
drizzle mapping #01
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Android 11; Mobile; rv:136.0) Gecko/136.0 Firefox/136.0
Browser:
Firefox Mobile 136
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
reduce
311090.0 Ops/sec
for
315742.2 Ops/sec
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) }