HTML Preparation code:
Script Preparation code:
Tests:

Historical Performance Data aggregated from 109 community runs

Desktop Results:
Chrome 92 runs
keyBy with for loop
8.3M/s
keyBy with native reduce
7.9M/s
lodash/keyBy
6.3M/s
keyBy with forEach
4.6M/s

Fastest: keyBy with for loop (1.8x faster)

View exact numbers
  • keyBy with for loop: 8,326,833 ops/sec
  • keyBy with native reduce: 7,858,336 ops/sec
  • lodash/keyBy: 6,250,061 ops/sec
  • keyBy with forEach: 4,591,794 ops/sec
Firefox 7 runs
keyBy with for loop
30.5M/s
keyBy with native reduce
21.5M/s
keyBy with forEach
15.1M/s
lodash/keyBy
12.7M/s

Fastest: keyBy with for loop (2.4x faster)

View exact numbers
  • keyBy with for loop: 30,488,516 ops/sec
  • keyBy with native reduce: 21,472,016 ops/sec
  • keyBy with forEach: 15,122,847 ops/sec
  • lodash/keyBy: 12,684,586 ops/sec
Safari 5 runs
keyBy with for loop
11.8M/s
lodash/keyBy
9.2M/s
keyBy with native reduce
8.3M/s
keyBy with forEach
6.9M/s

Fastest: keyBy with for loop (1.7x faster)

View exact numbers
  • keyBy with for loop: 11,829,263 ops/sec
  • lodash/keyBy: 9,190,461 ops/sec
  • keyBy with native reduce: 8,318,224 ops/sec
  • keyBy with forEach: 6,900,733 ops/sec
Mobile Results:
Chrome 5 runs
keyBy with for loop
8.7M/s
lodash/keyBy
8.0M/s
keyBy with native reduce
7.5M/s
keyBy with forEach
5.6M/s

Fastest: keyBy with for loop (1.6x faster)

View exact numbers
  • keyBy with for loop: 8,715,057 ops/sec
  • lodash/keyBy: 7,995,477 ops/sec
  • keyBy with native reduce: 7,452,391 ops/sec
  • keyBy with forEach: 5,618,071 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    lodash/keyBy
    keyBy with native reduce
    keyBy with forEach
    keyBy with for loop

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 8 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 OPR/125.0.0.0
Opera 125 on Windows
View result in a separate tab
keyBy with for loop
12.3M/s
keyBy with native reduce
11.2M/s
keyBy with forEach
8.2M/s
lodash/keyBy
8.1M/s
View exact numbers
Test name Executions per second
keyBy with for loop 12,332,040 Ops/sec
keyBy with native reduce 11,192,153 Ops/sec
keyBy with forEach 8,187,848 Ops/sec
lodash/keyBy 8,060,600 Ops/sec