Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Perl Optimization

by damian1301 (Curate)
on Jun 02, 2001 at 07:59 UTC ( #85152=note: print w/replies, xml ) Need Help??


in reply to Perl Optimization

Just some slight, stupid optimizations to save the slightest bit of space.

  • substr before regex (if possible). transliteration before regex. Use regex as last resort.
  • use single quotes if no interpolation is needed (REALLY minor optimization).
  •  $foo ? $bar; is faster than $bar if $foo; which is faster than if($foo){$bar}.
  • require is always faster than use.
  • use Memoize if that slow function that is called a couple times needs speeding up.


Tiptoeing up to a Perl hacker.
Dave AKA damian

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://85152]
help
Chatterbox?
[Discipulus]: no fear: moonday i'll back (unless a big quake ... ;=)
[Corion]: Discipulus: Being out in nature is great, at least as long as you have a dry place to sleep and a warm fire ;)
[Discipulus]: my whishlist include more "elements" anyway

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (12)
As of 2017-02-24 09:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (353 votes). Check out past polls.