in reply to Re: Why use threads over processes, or why use processes over threads?
in thread Why use threads over processes, or why use processes over threads?

liz, do you have any benchmarks (performance and memory usage) of threads vs. forks.pm?
  • Comment on Re: Re: Why use threads over processes, or why use processes over threads?

Replies are listed 'Best First'.
Re: Re: Re: Why use threads over processes, or why use processes over threads?
by liz (Monsignor) on Nov 11, 2003 at 18:17 UTC
    I thought I could easily adapt Benchmark::Thread::Size to use forks, but there is more to it than I can easily fix right now. This will probably need new versions of both forks and Benchmark::Thread::Size. In the meantime, I'm posting the result of using threads on Mac OS X:
    $ perl5.8.2-threaded -MBenchmark::Thread::Size Performing each test 10 times (ref) 10 100 # (ref) + 0 1730 ± 6 1 2085 ± 6 2 2374 ± 6 5 3235 ± 6 10 4664 20 7536 ± 4 50 16144 ± 2 100 30489 ± 8
    I'll post the result using forks as a response to this node.

    Liz

Re: Re: Re: Why use threads over processes, or why use processes over threads?
by liz (Monsignor) on Nov 11, 2003 at 21:22 UTC
    There still seems to be a problem with processes not getting reaped when calculating sizes. The combination of Benchmark::Thread::Size and forks becomes something akin to a fork bomb. Preliminary size test shows this:
    $ perl5.8.2-unthreaded -Mforks -MBenchmark::Thread::Size=times,1 (ref) 1 100 # (ref) + 0 3364 1 2836 2 2800 5 2800 10 2800 20 2800 50 2800 100 2804
    but I'm starting to have doubts whether the size calculation is correct. I don't have time to look into it further right now...

    This test was done with my internal development versions of forks and Benchmark::Thread::Size. Don't try this at home with the release versions yet!

    Liz