in reply to munging function names with AUTOLOAD

It might be fun to mess with, but in my opinion this is not really worth your time if its not just for your entertainment. Using AUTOLOAD as a dispatcher is faster than you might think, and going to great lengths (magically rewriting opcodes in caller code!) to squeeze out that much performance is not worth the major obfuscation it will cause.

If I really needed to do this and it wasn't fast enough using AUTOLOAD for dispatch, I would look at using a pre-processor and ditching AUTOLOAD altogether.

  • Comment on Re: munging function names with AUTOLOAD

Replies are listed 'Best First'.
Re: Re: munging function names with AUTOLOAD
by jimc (Sexton) on Jan 13, 2003 at 21:03 UTC
    your point is well taken - I use AUTOLOAD a lot, and have never found a need to do this. But AUTOLOAD is not the only overhead to be avoided - theres also stack walking that could be avoided.

    truth be told - this is for a possible patch to Log::Log4perl, whose authors are rightly concerned with performance, since the impact of inefficiencies can add up VERY quickly doing logging across an entire system.

    btw - Im starting to look at optimizer.pm - which may be the complete answer.. Any elaboration on this is welcome.