From: Ryan Davis Date: 2010-10-08T10:27:39+09:00 Subject: Re: Benchmarks Project and example for `||=` On Oct 7, 2010, at 15:11 , Intransition wrote: > However, if I am really concerned about squeezing out every bit of > speed, I would do: > > class X > def initialize > @f = ( do_some_calc_or_lookup ) > end > def f > @f > end > end There is a damn good reason why lazy initializing exists in the first place, and it invalidates your statement above. If you were __really__ concerned about squeezing out every bit of speed, you'd profile the code to see how it is used. If #f isn't being called in a tight loop, or isn't even being called much at all, then you might be spending more time running initialize than you would have doing the lazy initialize. You'll never know that mentarbating over micro-benchmarks.