Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Just how efficent is using system() ?

by grinder (Bishop)
on Jul 02, 2003 at 20:50 UTC ( [id://270946]=note: print w/replies, xml ) Need Help??


in reply to Just how efficent is using system() ?

halley speaks the truth. Who cares?

But your question is "how efficient is using system()". The answer is "not very". The kernel, at least in Unix land, has to allocate all sorts of structures to take the current process in order to fork it and take the child process and replace it with the process you want to run. This takes a non-trivial amount of time, at least as far as a CPU is concerned.

In Win32 land the cost is similar; CreateProcess (or whatever it's called these days, I haven't touched the Windows API in 10 years) is not something you want to do in a tight inner loop.

Anyway, you can consider that the upfront cost of performing a system call to be in the range of several hundred milliseconds. The second time you call it, the OS cache has been warmed and most of what you need is in RAM, so the subsequent cost drops by maybe an order of magnitude, so you're looking at possibly sub-100 millisecond start up time.

What does this mean? Even if, in the worst case, the overall length of a single process run is one second, inserting "several thousand" records is going to take between one, two hours or a bit more. Do a run with the first ten records, ensure that it works, then fire up the rest and go out to lunch. While you're enjoying yourself, the computer is slowly grinding through the workload. Where's the wastage in that? Better than rendering a screen saver in any event.

The other thing that springs to mind is that if you explain your problem in a bit more detail, some monk is going to pipe up and say "Oh, you just need to install Kerberos::MIT::Bulkloader and you can feed it a comma-delimited file and you're done." But without more information we just can't be sure.

_____________________________________________
Come to YAPC::Europe 2003 in Paris, 23-25 July 2003.

Replies are listed 'Best First'.
Re: Re: Just how efficent is using system() ?
by astaines (Curate) on Jul 02, 2003 at 22:22 UTC

    Google for "kerberos database perl" and you get this where Dave Steiner proposes a module for parsing a Kerberos database.
    This might do what you want....

    --
    Anthony Staines

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-03-29 11:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found