Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In Ruby’s 1.8 series, local variables introduced in the body of a block are not assigned constant offsets in the local variable array. Ruby’s interpreter keeps a list of these variables and searches the list when accessing such a variable. You can avoid this overhead by changing a block local variable into a method local variable by assigning it some value before entering the block.
For example, change