good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^4: Module for transparently forking a sub?by samtregar (Abbot) |
on Feb 14, 2009 at 05:33 UTC ( [id://743771]=note: print w/replies, xml ) | Need Help?? |
Ok, I took the bait and my faith in the general slowness of threading remains intact. Here's my results:
And here's my code:
As I was coding it I realized it's kind of a bizarre benchmark since it's not really testing any concurency. It's only testing how fast a single thread/process can be spawned and send back data. And really there's just no way Perl's threads are going to beat fork() at that test! One neat thing I learned - I didn't realize you could use use Storable's store_fd() and fd_retrieve() to pass messages like this. I'd previously used nstore() and thaw() with a prefixed length() of the message so the other end would know how much to read. This is so much easier! -sam PS: I just noticed you're on Windows (or DOS, I guess)! You don't have a real fork() there, so I guess you're not going to be able to replicate my results. Oh well.
In Section
Seekers of Perl Wisdom
|
|