From: Urabe Shyouhei Date: 2014-01-22T12:16:30+09:00 Subject: [ruby-core:59953] Re: [ruby-trunk - Feature #9425] [PATCH] st: use power-of-two sizes to avoid slow modulo ops On 01/21/2014 11:38 AM, Eric Wong wrote: >> https://github.com/shyouhei/ruby/commit/f7ca891 > > Thanks! However, I wasn't able to show a difference with > "make benchmark"[1]. Were you? > > Perhaps rehash is not called often enough, and I think a branch > inside the loop is difficult for the CPU to optimize. I think > the current dumb loop is very good for CPU pipelining and prefetch. No, sorry I see no evident speedup. When I wrote the patch I thought the function was used for Hash#rehash, but it turned out Hash#rehash uses something different (don't know why). The optimization is valid I believe but in fact used very rarely.