| PLEX86 | ||
|
understanding shared memory 3324Black Sun and said: Hm. 9-10 for Hubris, 0-10 for Laziness. :-) ? fork() doesn't come into the picture for subroutines. Did you mean "spawn a child process that does $STUFF"? "Just as soon". If the performance is OK, this'll work, but remember there's startup time buttociated with the module. If you can start the module once and pipe 100 things to it, it might work faster than starting the module 100 times and having each instance process 1 thing. It will probably take more developing-debugging time to start a separate process for the spam-filtering and send junk to it via IPC. You'll have to figure out whether that time is worth it. I think you'll have to do some benchmarks and see what's going on. ...what about the next poor schmuck who has to maintain it? That's what is usually meant by "maintainable". As long as you've picked good variable names, avoided the weirder Perl syntax constructs, and put decent comments in, you'll probably be OK. understanding shared memory Sender: Linux Just some Perl-type discussion......(value = 2 cents :-) ) When you fork, you get an exact copy of the current process, (read "perldoc -f fork") and with Perl that means... Hm. Well, there's always times(). Page 234 of the Camel Book: Easily switching languages in Linux On Thu, 7 Apr 2005 15:12:50 -0400, G Dahler staggered into the Black Sun and said: If the environment variable LANG is set to C... $start=(times)0; # code for the junk you want to time goes here $end=(times)0; printf("user time for function X was %.3f seconds-n",$end-$start); There may be a profile module that handles fork() better or at least more explicitly on CPAN, so I'd check there too. Well, good luck. Mulbreasthreaded programming introduces all kinds of interesting ways to shoot yourself in the butt. I haven't done much with multiple threads in Perl, though. I do remember using Image::Magick on a fast dual-CPU machine and running into internal module problems (and the script ABENDing) whenever it tried to Ping() an image that was smaller than about 20x20 pixels. Same script didn't die on a slower single-CPU machine. I solved that problem in a somewhat inefficient way, but at least the script stopped dying at stupid, inconvenient times. comp.lang.perl.misc might also be a good place to lurk and ask Perl-specific questions since this isn't really a Perl newsfroup. HTH, -- Matt GThere is no Darkness in Eternity-But only Light too dim for us to see Brainbench MVP for Linux Admin mail: TRAP + SPAN don't belong
|
||||
understanding shared memory Sender: Linux Linux groups from Newsgroups The #1 Usenet Provider on the Internet
|
||||