http://www.perlmonks.org?node_id=967302


in reply to Performance improvement in perl scripts

I want some more clear information about the areas where we can apply optimization which will impact considerably in performances.
Eh, do you really expect useful answers? I can easily say that regular expressions with lots of backtracking are slow, and that there may be lots of improvement here, but that doesn't help you at all if you don't have any regular expressions, or if you are solving a problem that requires a lot of backtracking to begin with.

What you need to do is not only measure, but also to define goals. When is your program "good enough"? If you have a cron job that does a nightly job starting at 2 AM, and runs for an hour when noone is waiting for the results, there's unlikely to be a reason to optimize, even if you can bring the run time down to 1 minute.

OTOH, if you're selling on a website, and you notice that people surf away if rendering a page takes more than X seconds, saving off a few microseconds in a hot loop may have a noticeable effect in the number of sales you make. Or maybe not. You should measure to be sure.