Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Object values vs _.values vs polyfill vs map polyfill
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0
Browser:
Firefox 131
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
_.values
5100061.5 Ops/sec
Object values
23584346.0 Ops/sec
proposal-object-values-entries/polyfill.js
1486864.6 Ops/sec
polyfill with map
12231244.0 Ops/sec
HTML Preparation code:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.core.js"></script> <script> const reduce = Function.bind.call(Function.call, Array.prototype.reduce); const isEnumerable = Function.bind.call(Function.call, Object.prototype.propertyIsEnumerable); const concat = Function.bind.call(Function.call, Array.prototype.concat); const keys = Reflect.ownKeys; if (!Object.valuess) { Object.valuess = function values(O) { return reduce(keys(O), (v, k) => concat(v, typeof k === 'string' && isEnumerable(O, k) ? [O[k]] : []), []); }; } if (!Object.valuesmap) { Object.valuesmap = function(obj) {return Object.keys(obj).map(function(e) {return obj[e];});}; } </script>
Script Preparation code:
var a = { a: 1, b: 2, c: 3};
Tests:
_.values
_.values(a);
Object values
Object.values(a);
proposal-object-values-entries/polyfill.js
Object.valuess(a);
polyfill with map
Object.valuesmap(a);