HTML Preparation code:
AخA
 
1
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.core.js"></script>
Script Preparation code:
x
 
function extractValues(obj) {
   const t = [];
   for(var key in obj) { t.push(key); }
   return t;
}
function extractValuesNumver(obj) {
   const t = [];
   for(var key in obj) { t.push(Number(key)); }
   return t;
}
Tests:
  • Object.values(obj)

     
    var a = { 1: 1, 2: 2, 3: 3};
    Object.values(a);
  • _.values(obj)

     
    var a = { 1: 1, 2: 2, 3: 3};
    _.values(a);
  • for...in

     
    var a = { 1: 1, 2: 2, 3: 3};
    extractValues(a);
  • for...in number

     
    var a = { 1: 1, 2: 2, 3: 3};
    extractValuesNumver(a);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Object.values(obj)
    _.values(obj)
    for...in
    for...in number

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36
Chrome 83 on Windows
View result in a separate tab
Test name Executions per second
Object.values(obj) 1835656.4 Ops/sec
_.values(obj) 1327908.9 Ops/sec
for...in 1571272.6 Ops/sec
for...in number 658470.8 Ops/sec