Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Print Vs Return In a Subroutine

by bart (Canon)
on Mar 30, 2012 at 10:40 UTC ( #962561=note: print w/ replies, xml ) Need Help??

in reply to Print Vs Return In a Subroutine

You're micro-optimizing. Stop it.

Just make your code work, and when you think it woks too slow, benchmark the likely culprits and improve those, if necessary.

With Time::HiRes you can get the current time in microseconds, so you can measure quite precisely how long a piece of code takes.

Comment on Re: Print Vs Return In a Subroutine
Replies are listed 'Best First'.
Re^2: Print Vs Return In a Subroutine
by chrestomanci (Priest) on Mar 30, 2012 at 12:38 UTC

    Agreed, premature optimizing is a bad thing.

    Also in the not recommended category is trying to write your own profiler by peppering your code with calls to Time::HiRes::time. Much better to run the code through a proper profiler such as Devel::NYTProf, that will do a much better job, will profile everything including the stuff you did not think was a bottleneck, and will give you a nicely formatted report to look at.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2016-05-30 07:11 GMT
Find Nodes?
    Voting Booth?