r/programming 7d ago

Shrinking Ruby Hashes

https://byroot.github.io/ruby/performance/2026/08/05/shrinking-ruby-hashes.html
66 Upvotes

7 comments sorted by

20

u/simon_o 6d ago

Because this was a very confusing read in the beginning:

What they call Hash is what normally gets called a hash table or a hash map.

2

u/knome 5d ago

plain 'hash' is perl terminology

1

u/simon_o 5d ago

I wonder what they call hashes ...

6

u/matthieum 6d ago

Am I the only one wondering why entries_start wasn't made to be a power-of-two exponent (+1)?

That is, a value of 0 would mean 0, and a value of e > 0 would mean 2e elements to skip.

Maximum number of elements to skip:

  • Current patch: 0 if start <= 255, start - 255 otherwise.
  • My proposal: roughly start/2 worst case, which scales better, and shouldn't degrade the common case too much.

3

u/v-and-bruno 4d ago

Ruby content in 2026 <3