in reply to How do I get better at thinking about optimizing my Perl?

It's no different from C really. To make things faster, do less work. The big gains come from eliminating I/O or improving your algorithm. Sometimes you can cache things. Sometimes you can write better SQL.

The only thing that gets very Perl-specific is learning which modules are faster (Storable beats Data::Dumper, the shared memory cache modules are slow) and some API specifics for common modules like DBI (prepare_cached, bind_cols).

One thing that I do consider a bit of a black art is regex optimization, but you'll find there are a number of tools to help with that, and some very knowledgeable people on PerlMonks who I often turn to with my regex problems.

  • Comment on Re: How do I get better at thinking about optimizing my Perl?