You might also like

When Are You Required To Set Objects To Nothing?
Lost Recordings of _why's Last Lecture
Should You Be Designing With QR Codes?


Phil Oliver

"Suppose that the Ruby 2.0 garbage collector code needs to mark the fifth RValue object in this heap, referred to by the ptr value. The memory alignment trick allows Ruby 2.0 to take the ptr value and quickly calculate the address of it’s heap header structure. All Ruby 2.0 has to do is mask out the last few bits of the RValue address, the “68” hexadecimal offset in this example, to obtain the address of the header structure, at “membase” or 0x80FFC000 in this 32-bit example."

Yes, constant time lookup is always preferable to traversing a list. That was an optimization I identified recently for a cubic-spline algorithm.

about 5 years ago   Like_icon 1 likes  
Jared Brown

+1 for anything that makes Ruby faster

about 5 years ago   Like_icon 0 likes  

Talentopoly Newsletter

A once-weekly round-up of the best programming and design posts.

Join 2050+ subscribers

We will never spam or share your email address. Easily unsubscribe


This post sure could use some tags.
No one realizes how awesome this post is yet.