in reply to The need for speed

A couple of small optimizations, the real issues seem to be covered already.

Any busy fixed size hashes like %states may be converted to arrays:

use constant bounced => 0; use constant deferred => 1; use constant directory => 2; # et cetera my @states;

Regexes like  next if (!/MsgTrace/); should be faster if anchored, I'm just guessing at the values here  next if ( !/^.{52,55}MsgTrace/);

Replies are listed 'Best First'.
Re: Re: The need for speed
by cees (Curate) on Jan 25, 2003 at 05:35 UTC

    Since the regex is just looking for a fixed string, wouldn't it be faster to just use index?

    next if index($_, 'MsgTrace') == -1;
    I like your anchoring idea though. I'll have to remember that one.