Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Lodash omit vs es omit vs compiled omit vs rest and delete omit
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:150.0) Gecko/20100101 Firefox/150.0
Browser:
Firefox 150
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
7 days ago
Test name
Executions per second
Lodash
1264347.2 Ops/sec
es omit
2620821.0 Ops/sec
compiled omit
9194213.0 Ops/sec
rest and delete omit
1816985.2 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script> <script src=''> </script>
Script Preparation code:
var omit1 = (originalObj = {}, keysToOmit = []) => Object.fromEntries( Object.entries(originalObj) .filter(([key]) => !keysToOmit.includes(key)) ) var omit2 = new Function('obj', 'if (!obj) return {}; const { a, d, i, ...res } = obj; return res;'); var omit3 = (originalObject = {}, keysToOmit = []) => { const clonedObject = { ...originalObject }; for (const path of keysToOmit) { delete clonedObject[path] } return clonedObject; }
Tests:
Lodash
const obj = { a:1, b:1, c:1, d:1, e:1, f:1, g:1, h:1, i:1, } const n = _.omit(obj, ['a','d','i']);
es omit
const obj = { a:1, b:1, c:1, d:1, e:1, f:1, g:1, h:1, i:1, } const n = omit1(obj, ['a','d','i']);
compiled omit
const obj = { a:1, b:1, c:1, d:1, e:1, f:1, g:1, h:1, i:1, } const n = omit2(obj, ['a','d','i']);
rest and delete omit
const obj = { a:1, b:1, c:1, d:1, e:1, f:1, g:1, h:1, i:1, } const n = omit3(obj, ['a','d','i']);