in reply to Re^12: Amicable divorce
in thread Amicable divorce

> Perl 5.8 threads was a compromise where everything is cloned so that there is no interference between threads and whenever you want to share something, you have to say it explicitly and an intermediate (and quite inefficient) layer that does the locking and serializes access is set up by the runtime.

I'm by far no expert here, but I remember seeing benchmarks where the Perl approach actually did beat Python's GIL in terms of performance.

But benchmarks are like statistics, the author often only measures his own prejudices ... ;-)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^14: Amicable divorce
by salva (Canon) on Jul 24, 2020 at 21:35 UTC
    I'm by far no expert here, but I remember seeing benchmarks where the Perl approach actually did beat Python's GIL in terms of performance.

    Different trade-offs: Python thread creation is cheap, but then they don't run in parallel except when performing I/O operations. Data is shared and there is no overhead for using threads.

    Perl on the other hand, has a very costly thread creation, both in terms of CPU and memory. But then they run in parallel using all the available CPUs. Data is only shared between threads when explicitly requested by the programmer and accessing the shared data has an important overhead.