summaryrefslogtreecommitdiffhomepage
path: root/examples/format_codes_example.md
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-05-26 15:21:13 +0200
committerGeremia Taglialatela <[email protected]>2023-05-26 15:21:13 +0200
commit2ed27823eaeb345e383343fb70dfa3f205f71ca1 (patch)
treed0eb22ca642d70272fa4e5c4f30e30e7c9f38685 /examples/format_codes_example.md
parent63a6edf1e191cf91fb80717ebae67c78af0d7db5 (diff)
downloadcaxlsx-2ed27823eaeb345e383343fb70dfa3f205f71ca1.tar.gz
caxlsx-2ed27823eaeb345e383343fb70dfa3f205f71ca1.zip
Fix Style/HashEachMethods offense
Replace `keys.each` with hash iteration ```rb MY_HASH = { first: '1', second: '2', third: '3' } %i[ips memory].each do |benchmark| Benchmark.send(benchmark) do |x| x.report("each_key") { MY_HASH.each_key { |k| MY_HASH[k] } } x.report("keys.each") { MY_HASH.keys.each { |k| MY_HASH[k] } } x.report("each") { MY_HASH.each { |k, v| v } } x.compare! end end ``` ``` IPS Comparison: each: 4283031.6 i/s each_key: 3683407.4 i/s - 1.16x (± 0.00) slower keys.each: 3387425.1 i/s - 1.26x (± 0.00) slower Memory Comparison: each_key: 0 allocated each: 0 allocated - same keys.each: 40 allocated - Infx more ```
Diffstat (limited to 'examples/format_codes_example.md')
0 files changed, 0 insertions, 0 deletions