Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Perl usually installed without thread support?

Tags:

perl

perlbrew

Perlbrew installs per default Perl without thread support. Is this just a legacy habit or could a Perl installation with thread support generate problems?

like image 799
Matteo Avatar asked May 15 '14 06:05

Matteo


3 Answers

Compiling Perl with thread supports adds a lot of overhead due to all the locking, even if you don't use threads in your program. I measured about 15% overhead for a simple benchmark just by using Perl compiled with threads support.

like image 102
Steffen Ullrich Avatar answered Oct 18 '22 23:10

Steffen Ullrich


Because it isn't robust and performant enough to be the default.

Besides that, you have to consider CPAN. There are too many modules written in C without concern for threads.

I say this with all due love and respect as an ex-Perl6 / Parrot developer. Perl5 wasn't designed from the ground up with threading in mind (at least when I was involved in the community).

At this point, I don't think enough people care to change it. The future was going to be Perl6, and Parrot had threads very early. To destabilize Perl 5 at this point in its lifecycle is probably questionable.

It isn't like Perl is unique in this, Linux was the same way for a long time (as-in there was a big kernel lock that had to be dealt with). Most projects start like that, but some take it further than others before addressing it.

like image 23
codenheim Avatar answered Oct 18 '22 23:10

codenheim


As @steffen-ultisch said, it is a performance issue.

But, if one so wish, it is possible to easily install Perl both with and without threads, so you can use the version more proper to a given script.

The perlbrew installation, say for Perl 5.22.1, is:

perlbrew install-multiple 5.22.1 --both=thread
like image 4
gsl Avatar answered Oct 19 '22 00:10

gsl