HTML Preparation code:
AخA
 
1
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.5/lodash.min.js"></script>
Script Preparation code:
 
var object = {
  'a': {
    'key': 'a',
    'foo': 123123,
    'bar': 123,
    'fobar': 456
  },
  'b': {
    'key': 'b',
    'foo': 67563,
    'bar': 6345,
    'fobar': 3425
  },
  'c': {
    'key': 'c',
    'foo': 34532,
    'bar': 123412,
    'fobar': 534532
  },
  'd': {
    'key': 'd',
    'foo': 1234321,
    'bar': 435234,
    'fobar': 346457
  },
  'e': {
    'key': 'e',
    'foo': 23523,
    'bar': 124325,
    'fobar': 2134235
  },
  'f': {
    'key': 'f',
    'foo': 1235213,
    'bar': 346346,
    'fobar': 213423
  }
};
Tests:
  • Array.prototype.reduce()

     
    Object.keys(object).reduce(function(acc, cur) {
      acc.push(object[cur]);
      return acc;
    }, []);
  • _.reduce()

     
    _.reduce(object, function(acc, cur) {
      acc.push(cur);
      return acc;
    }, []);
  • _.values()

     
    _.values(object);
  • _.toArray()

     
    _.toArray(object);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Array.prototype.reduce()
    _.reduce()
    _.values()
    _.toArray()

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2025 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36
Chrome 64 on Mac OS X 10.13.3
View result in a separate tab
Test name Executions per second
Array.prototype.reduce() 733959.4 Ops/sec
_.reduce() 1213602.4 Ops/sec
_.values() 1662732.1 Ops/sec
_.toArray() 1557529.6 Ops/sec