Github messages for voidlinux
 help / color / mirror / Atom feed
From: mhmdanas <mhmdanas@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] python3: enable optimizations.
Date: Tue, 08 Aug 2023 20:40:02 +0200	[thread overview]
Message-ID: <20230808184002.LYww0ALl_2ZzW5A80t3N3-2RJhkssYkq6H0TJN-4gQE@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-43791@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 2404 bytes --]

There is an updated pull request by mhmdanas against master on the void-packages repository

https://github.com/mhmdanas/void-packages python3-enable-optimizations-flag
https://github.com/void-linux/void-packages/pull/43791

python3: enable optimizations.
This `--enable-optimizations` flag enables profile-guided optimizations (PGO) and link-time optimization (LTO, but apparently only sometimes, depending on the platform). My rudimentary benchmarking indicates that compared to python3 from the repos, python3 built from this PR yielded performance improvements of around 10%-12% (I tried building python3 from master locally, but that one had horrendous performance for some reason). I'm not a benchmarking expert though, so I wanted others to try out their own benchmarks and post their results here.

On my potato laptop, this change tripled build time from 5 minutes to 15 minutes. I don't think this is an issue however because changes to the python3 template are not done often (averaging once per month in the last 12 months), and the builders are much beefier than my laptop, so their build times will be even shorter anyway.

TODO:
- [ ] Is this also needed for `python3-tkinter`? (I don't think so, but better check)
- [ ] Are there similar performance improvements with cross builds? (PGO runs and profiles a Python that is compiled for the host architecture, which is why I want to confirm this)

#### Testing the changes
- I tested the changes in this PR: **YES** (only python3, not python3-tkinter)

@ahesford

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/43791.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-python3-enable-optimizations-flag-43791.patch --]
[-- Type: text/x-diff, Size: 1780 bytes --]

From 9a34543ec4ecfaee1aaf232d385a48edb39e6566 Mon Sep 17 00:00:00 2001
From: triallax <triallax@tutanota.com>
Date: Tue, 8 Aug 2023 17:27:43 +0100
Subject: [PATCH 1/2] python3: enable optimizations.

---
 srcpkgs/python3/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/python3/template b/srcpkgs/python3/template
index ef07cb7d2f396..ca23bbfc54895 100644
--- a/srcpkgs/python3/template
+++ b/srcpkgs/python3/template
@@ -4,9 +4,9 @@
 #
 pkgname=python3
 version=3.11.4
-revision=1
+revision=2
 build_style="gnu-configure"
-configure_args="--enable-shared --enable-ipv6
+configure_args="--enable-shared --enable-ipv6 --enable-optimizations
  --enable-loadable-sqlite-extensions --with-computed-gotos
  --with-dbmliborder=gdbm:ndbm --with-system-expat --with-system-ffi
  --without-ensurepip ac_cv_working_tzset=yes"

From eb0b7292e101be6ce21682de87d07cec72a29bb8 Mon Sep 17 00:00:00 2001
From: triallax <triallax@tutanota.com>
Date: Sun, 7 May 2023 19:40:32 +0300
Subject: [PATCH 2/2] python3-tkinter: enable optimizations.

---
 srcpkgs/python3-tkinter/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/python3-tkinter/template b/srcpkgs/python3-tkinter/template
index fc16bfdf9dce4..10e0fe38104c1 100644
--- a/srcpkgs/python3-tkinter/template
+++ b/srcpkgs/python3-tkinter/template
@@ -9,9 +9,9 @@ _desc="Python programming language"
 
 pkgname=python3-tkinter
 version=3.11.4
-revision=1
+revision=2
 build_style="gnu-configure"
-configure_args="--enable-shared --enable-ipv6
+configure_args="--enable-shared --enable-ipv6 --enable-optimizations
  --enable-loadable-sqlite-extensions --with-computed-gotos
  --with-dbmliborder=gdbm:ndbm --with-system-expat --with-system-ffi
  --without-ensurepip"

  parent reply	other threads:[~2023-08-08 18:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-07 16:51 [PR PATCH] " mhmdanas
2023-05-11 14:25 ` ahesford
2023-05-12 12:10 ` tornaria
2023-08-08 18:40 ` mhmdanas [this message]
2023-08-13 13:10 ` ahesford
2023-08-13 13:11 ` [PR PATCH] [Closed]: " ahesford
2023-08-14 12:55 ` tornaria
2023-08-14 12:56 ` tornaria

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230808184002.LYww0ALl_2ZzW5A80t3N3-2RJhkssYkq6H0TJN-4gQE@z \
    --to=mhmdanas@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).