Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Fastest way to get input from a filehandle

by japhy (Canon)
on Oct 29, 2005 at 15:15 UTC ( [id://503872]=note: print w/replies, xml ) Need Help??


in reply to Fastest way to get input from a filehandle

I would expect the fourth one is the slowest, since you're going out of your way to get a line. The first three are, I believe, identical.

But this is not where you should be looking for speed increases in your code. This is such a minor issue. You're over-optimizing.


Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart
  • Comment on Re: Fastest way to get input from a filehandle

Replies are listed 'Best First'.
Re^2: Fastest way to get input from a filehandle
by sauoq (Abbot) on Oct 29, 2005 at 16:34 UTC

    I would think the 2nd would be slowest since there is an extra step of getting the right filehandle from the string...

    $ perl -MO=Deparse -e 'readline(STDIN)' readline 'STDIN'; -e syntax OK
    Not sure when that happens though. (One time penalty?)

    I would expect the fourth to be about as quick as the others (after the open) as it's just dup'ing STDIN. Is it slower to store a filehandle in a lexical? (I wouldn't think so but have no real clue.)

    shrug

    Not that any of this changes the fact that it shouldn't matter to the OP. :-)

    -sauoq
    "My two cents aren't worth a dime.";
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (1)
As of 2024-04-18 23:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found