Summary: | lang/perl5*: Drop threads option and always enable it | ||||||
---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | Daniel Engberg <diizzy> | ||||
Component: | Individual Port(s) | Assignee: | Mathieu Arnold <mat> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Only Me | CC: | perl, pi, tom | ||||
Priority: | --- | ||||||
Version: | Latest | ||||||
Hardware: | Any | ||||||
OS: | Any | ||||||
Attachments: |
|
Please don't apply this patch. A threaded perl runs noticeably slower than a non-threaded perl. When building perl for general use, enabling threads makes the perl exexcutable compatible with a wider range of perl scripts. If you know the scripts you will run don't need threads, disabling "usethreads" will help performance. Hi Tom, Do you have any examples where you can replicate this? Best regards, Daniel To measure this, you can build perl from source with threads enabled and disabled. See perl's INSTALL file for details. I build a non-threaded perl with `sh Configure -des && make test` and a threaded perl with `sh Configure -des -Dusethreads && make test`. You will notice that building perl without threads is the default behaviour, due to their slowness. Depending on options different sets of tests is executed so make test can't be used to determine performance differences? tests=1185659 vs tests=1197409 Thank you for your investigation. I perhaps assumed too much knowledge of perl: `make test` runs perl's test suite to check it has compiled correctly. It is not designed as a benchmark. Once you have compiled perl, you will need to run a suitable set of benchmarks. What's suitable for you may not be suitable for someone else. However, I'll repeat my request that we keep the existing option: many organisations that push perl to its limits (and many that don't) have noticed performance benefits from compiling perl with threads disabled. That's why it's the default when you run `sh Configure`. Just tried a simple benchmark and threaded actually performed better (not by much but a few percent) on my Tigerlake based laptop. Code: use Benchmark; $main::x=join("",(a..z))x200000; &timethis(100,\&test); sub test { $main::x =~ s/(.*?)I/$1/isge; } Mat, ping? If we keep the option, I don't see any reason to switch the default for existing Perls, I'll investigate with perl-devel and maybe it'll be switched for 5.42. Thanks, please consider to drop it in 5.40 as this seems to works out just fine in other major distros. Ping about 5.40 As I said in comment 8, just above, I'll switch in perl5-devel, and then it will be in 5.42 when it gets released next year. A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=06754026a9ab4804ceeeda7fca869e0e5cd45b0c commit 06754026a9ab4804ceeeda7fca869e0e5cd45b0c Author: Mathieu Arnold <mat@FreeBSD.org> AuthorDate: 2024-08-30 10:51:38 +0000 Commit: Mathieu Arnold <mat@FreeBSD.org> CommitDate: 2024-08-30 11:06:18 +0000 lang/perl5-devel: update to 5.41.3 While there, drop the THREADS option [1] PR: 274192 [1] lang/perl5-devel/Makefile | 10 ++++------ lang/perl5-devel/distinfo | 6 +++--- lang/perl5-devel/files/patch-perl.c | 4 ++-- lang/perl5-devel/files/patch-t_porting_customized.dat | 4 ++-- lang/perl5-devel/pkg-plist | 8 ++++++++ lang/perl5-devel/version.mk | 2 +- 6 files changed, 20 insertions(+), 14 deletions(-) |
Created attachment 245347 [details] Patch for perl5 Looking at other distros and/or repos (Alpine, Arch, Debian, Fedora, Homebrew, openSUSE) this is hardcoded as always on except for Gentoo where it's enabled by default but optional. I can't find any obvious reason not to have it always on today and it also reduces a lot of complexity within the tree figuring out what port options were used during build (see graphics/ImageMagick* for example). Compile tested on FreeBSD 13.2-RELEASE (amd64)