Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: handler performance question

by Joost (Canon)
on Feb 04, 2009 at 01:19 UTC ( [id://741158]=note: print w/replies, xml ) Need Help??


in reply to handler performance question

I'd suspect the main slowdown is the system("mkdir ...") call. Assuming you have significantly less than 5 million car manufacturers you'd probably be better off

a) testing if the directory exists before attempting to create it

b) using the perl built-in mkdir command

c) cache this info. IOW, don't try to recreate a directory you've already created before. The difference between system and mkdir and stat is quite vast, but in this situation it completely dwarfed by the sheer amount of unnecessary calls you'd make. update: this is the important suggestion. you can ignore the rest for this particular problem.

Replies are listed 'Best First'.
Re^2: handler performance question
by ikegami (Patriarch) on Feb 04, 2009 at 03:02 UTC

    using the perl built-in mkdir command

    The Perl equivalent of mkdir -p is mkpath if you don't want to do the chain of mkdir commands. On the other hand, I don't see why -p is needed on any but the first call.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-04-25 10:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found