On Fri, 3 Nov 2000, Dave Thomas wrote:

> Yes, there is an overhead, although I'd have to do some digging to
> find out exactly how great.
> 
> You could eliminate the singleton at the expense of an extra instance
> variable by rewriting the methods as
> 
>    def <proxy method>
>      if !@<name_defined>
>        @name_defined = true
>        @name_value = <original method>
>      end
>      @name_value
>   end
> 
> but Funaba-san's technique is a lot more fun!
> 
Yeah, it's awesome! And with the technique above you get slightly worse
performance (or maybe not since a singleton class is inserted so that
there is an extra layer of indirection?)...

Ps. I actually tried them out and the technique above is about 15% slower.
If we can find some mem figures we can explore the trade-off! ;-)

Regards,

Robert