From: Daniel DeLorme Date: 2008-03-13T09:48:17+09:00 Subject: Re: Copy-on-write friendly garbage collector Hongli Lai wrote: > Great work Daniel. I don't measure the same amount of speedup that you > claim in your email, but there is definitely a small speedup. > > I've added some further further optimizations. > find_position_in_bitfield() now uses bit operators instead of division > and modulo operators. This should speed things up a little more. > > The attached patch is created against Ruby 1.8, but it shows what I've > exactly changed. Thank you. I also looked at find_position_in_bitfield() but I assumed the compiler would be able to make those optimizations, so ended up not touching it. I notice that this patch is relative to one of the patches that I submitted. But in those patches I changed the bsearch to a linear search, which may not be desirable as Matz pointed out. But I'm not sure it's a good idea to sacrifice performance now for the sake of a hypothetical change in heap size in the future (YAGNI). Maybe a #define could take care of that? e.g. #ifdef FEW_HEAPS order heaps by size, linear search #else order heaps by memory location, bsearch #endif -- Daniel