.selectVS.eachVS.count

Benchmark to test the performance difference between Hash.select, Hash.values.count, and the old fashion .each iterator.

.selectVS.eachVS.count

Benchmark to test the performance difference between Hash.select, Hash.values.count, and the old fashion .each iterator

Usage

  • crystal selectvseachvscount.cr --release

Current Results:

Final Thoughts

  • Looks like the old fashion .each iterator and .count are beasts! Assuming the benchmark is not skewed and correct (please submit a new PR to fix)
  • Also seems like, sometimes developers can fall into the trap of using .select. However, if you just need to obtain the size of a hash / array, .count, and .each are much faster.

Contributing

  • This is still a work in progress, if you can enhance this benchmark please submit a PR or issue, thanks!
  • Thanks for stopping by!
Repository

.selectVS.eachVS.count

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 0
  • over 4 years ago
  • October 8, 2019
License

Links
Synced at

Fri, 17 May 2024 09:03:41 GMT

Languages