in reply to Inline subs?

Just an idea from me, I'm still pretty low in the food chain in perl, but could you possibly write your sub as a very small module? That might speed things up a bit.

Replies are listed 'Best First'.
Re: Re: Inline subs?
by chromatic (Archbishop) on May 02, 2003 at 19:19 UTC

    Probably not. Subs can be slow because it's expensive to create, initialize, and enter a new lexical scope in Perl 5's internal stack-based system. Inlining is tricky because you still have to respect that lexical scoping -- and I doubt you'll get very much of a speed benefit because, in all but the simplest cases, you still have to pay the price of the ENTER/LEAVE ops.

    You'll avoid the cost of sub dispatch and you might have better code coherency (though it'll depend on where the stash is located), but I'm not convinced you'll see dramatic benefits.

    It'd probably be better to make ENTER/LEAVE faster than to treat the symptom.