You might also like

Why You Should Be Excited About Garbage Collection in Ruby 2.0
Why mobile web apps are slow
When Are You Required To Set Objects To Nothing?

Comments

Phil_oliver-1_thumb
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 2 years ago   Like_icon 1 likes  
Jared_gaze_thumb
Jared Brown

+1 for anything that makes Ruby faster

about 2 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

Tags

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