Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Inline subs?

by nadadogg (Acolyte)
on May 02, 2003 at 18:44 UTC ( [id://255122]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://255122]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-03-29 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found