Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: File I/O Slow Down

by Ryszard (Priest)
on Aug 05, 2003 at 06:18 UTC ( [id://280891]=note: print w/replies, xml ) Need Help??


in reply to File I/O Slow Down

Something i recently learned was the 'o' modifier in regex's.

It tells perl you're not going to change the regex, so its only compiled once, not every time, (ie its no good if you're using variables in your regex).

next if($_ =~ m/^#/); try as next if($_ =~ m/^#/o);

Execute your script with time to benchmark the performance, ie time parser.pl. If you get better performance, cool, you've got it for almost no effort, if you dont, well, you've spent almost no time on it..

While its not exactly IO related, it may speed up your program.

Replies are listed 'Best First'.
Re: Re: File I/O Slow Down
by waswas-fng (Curate) on Aug 05, 2003 at 07:36 UTC
    blah, don't use /o use qr//. His issue was with the split as pointed out above and he may also be having an issue with the size of his hashes once he loads all of that data in. hashes tend to be fairly large in memory for the speedy lookup. classic perl memory for speed tradeoff.

    -Waswas
Re: Re: File I/O Slow Down
by diotalevi (Canon) on Aug 05, 2003 at 14:56 UTC
      Dunno about that, I learnt/found out about it via a presentation at YAPC::Europe::Paris. Perhaps i missunderstood the meaning of that part of the presentation...

      None the less, i'm off to look at your node..

        I noticed that MJD has recently updated the slides for his Regular Expression Mastery talk (could this be what you saw at YAPC?), and despite having changed several slides, this one is still a part of persentation set, so presumably, he thinks /o still has some value.


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
        If I understand your problem, I can solve it! Of course, the same can be said for you.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-16 05:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found