Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Uniq by sorting test
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0
Browser:
Chrome 126
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Lodash uniqBy
3437.6 Ops/sec
Custom uniq array
823.6 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js'></script>
Script Preparation code:
var myArr = Array.from({ length: 16000 }, () => ({ value: Math.floor(Math.random() * 1000) })); var myCopy = null;
Tests:
Lodash uniqBy
myCopy = _.uniqBy(myArr, 'value');
Custom uniq array
const itemIdSet = new Set(myArr.map(item => item.value)); const uniqueItems = []; itemIdSet.forEach(value => { const uniqueItem = myArr.find(item => item.value === value); if (uniqueItem) uniqueItems.push(uniqueItem); }); myCopy = uniqueItems;