Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Pls help optomize - ksh version 60% faster!

by Skeeve (Parson)
on Sep 28, 2005 at 21:43 UTC ( [id://495907]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://495907]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-25 13:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found