Benchmarking the code change in gatsbyjs/gatsby#7909
Example results on my machine:
// Model Name: MacBook Pro
// Model Identifier: MacBookPro14,3
// Processor Name: Intel Core i7
// Processor Speed: 2.8 GHz
// Number of Processors: 1
// Total Number of Cores: 4
// Memory: 16 GB
Starting benchmark
Array#includes => true (first item) x 90,527,340 ops/sec ±0.64% (84 runs sampled)
Array#includes => true (last item) x 48,148,045 ops/sec ±0.65% (88 runs sampled)
Array#includes => false x 44,982,781 ops/sec ±1.19% (88 runs sampled)
object property access => true (first item) x 555,733,626 ops/sec ±0.62% (83 runs sampled)
object property access => true (last item) x 565,248,917 ops/sec ±0.53% (90 runs sampled)
object property access => false x 553,660,965 ops/sec ±0.71% (89 runs sampled)
Set#has => true (first item) x 88,575,457 ops/sec ±1.15% (81 runs sampled)
Set#has => true (last item) x 93,230,253 ops/sec ±0.68% (89 runs sampled)
Set#has => false x 64,147,568 ops/sec ±0.53% (87 runs sampled)
Map#get => true (first item) x 579,591,059 ops/sec ±0.63% (87 runs sampled)
Map#get => true (last item) x 573,527,387 ops/sec ±0.64% (86 runs sampled)
Map#get => false x 581,403,037 ops/sec ±0.49% (91 runs sampled)
Fastest:
- Map#get => false
- Map#get => true (first item)