You dismissed method 2 as possibly being too much of a performance hit, since it involves passing a scalar variable containing a reference into each subroutine.
But your preferred method involves calling an extra subroutine every time you want to access your object. I haven't done any tests, but I'd be surprised if sticking an extra param in an existing sub call is more costly than making a whole new call. Especially if in a particular sub you do ten method calls on your object — you've now replaced one param with ten function calls.
Did you actually have a problem with your code running too slow, or did you just get the urge to do this because you suspected there might be one?
In reply to Re: Avoiding global object handle
by Smylers
in thread Avoiding global object handle
by Biker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |