in reply to Pls help optomize - ksh version 60% faster!

I really can't tell what you are doing there. What I noticed is:
  1. You are "split(ing) the entry type from the actual verbage to be searched for" for each and every log file entry found.
    Better is to do that once and for every ini file entry outside the loop
  2. You are using some "strange constructs" like
    if (condition) { next LOOP; } else { # main part to do }
    instead of the "cleaner" solution without else.
    But I don't think this will add to the running time
  3. Something I only use in java and never in perl found here: if (length($entry) == 0)why not simply: if (not $entry) or even if ($entry eq "")? But again: Not that runtime issue, i think.
I'd suggest to fix the entry preparation first.

Update: Thanks to ikegami for reminding me of 0 ;-)

$\=~s;s*.*;q^|D9JYJ^^qq^\//\\\///^;ex;print

Replies are listed 'Best First'.
Re^2: Pls help optomize - ksh version 60% faster!
by ikegami (Patriarch) on Sep 28, 2005 at 21:50 UTC
    why not simply: if (not $entry)

    Because that would also be false for "0".

    if ($entry eq "")
    (as you mentioned) works, and so does
    if (not length $entry)
    (my usual) and
    unless (length $entry)

      Actually I had those that way originally.. there was a $entry that passing the if. What's left was my attempts at finding that problem. I could now revert them back.