Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
duplication resolution
(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(500).fill(null).map(function (_, i) { return {toto: i, titi: 'hello'}; }); var keys = ['toto'];
Tests:
M
Object.values(records.reduce(function (acc, record) { const key = keys.map(function (key) { return `${key}: ${record[key]}`; }).join(';'); 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
Object spread vs New map
Object spread vs New map with string keys
test_spread_vs-map
Array.fill vs Array.from with dyamnic data
Comments
Confirm delete:
Do you really want to delete benchmark?