Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
duplication resolution 3
(version: 0)
Comparing performance of:
M vs C
Created:
3 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var records = new Array(20).fill(null).map(function (_, i) { return {toto: i, titi: 'hello'}; }); var keys = ['toto'];
Tests:
M
Object.values(records.reduce(function (acc, record) { const key = JSON.stringify(keys.reduce(function (acc, key) { acc[key] = record[key]; return acc }, {})) if (!acc[key]) { acc[key] = record; } return acc; }, {}));
C
records.reduce(function (acc, cur) { const isDup = acc.some(function (item) { var isDup = true; for (const key of keys) { if (item[key] !== cur[key]) { isDup = false; } } return isDup; }); if (!isDup) { acc.push(cur); } return acc; }, []);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
M
C
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:
Array range generating
duplication resolution
duplication resolution 2
duplication resolution 4
Comments
Confirm delete:
Do you really want to delete benchmark?