summaryrefslogtreecommitdiff
path: root/gnu/packages/python.scm
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2021-03-18 23:41:40 +0100
committerJulien Lepiller <julien@lepiller.eu>2021-06-11 02:39:29 +0200
commit99d450b085b7bf44d669093f6c9964391ce1b451 (patch)
treeed805603a7a4b85bdcc4ddb9c7d5ceb4ac39500f /gnu/packages/python.scm
parent20d52562e5c943b30e48e310b58b94054c3a54e5 (diff)
downloadguix-patches-99d450b085b7bf44d669093f6c9964391ce1b451.tar
guix-patches-99d450b085b7bf44d669093f6c9964391ce1b451.tar.gz
gnu: python: Enable optimizations.
As a result, python execution time of scripts is decreased by 6 to 40%. gnu/packages/python (python-2.7)[arguments]: Add configure and make flags to optimize the resulting python.
Diffstat (limited to 'gnu/packages/python.scm')
-rw-r--r--gnu/packages/python.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 9e29733091..ca15147c56 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -184,7 +184,10 @@
"--with-system-expat" ;for XML support
"--with-system-ffi" ;build ctypes
"--with-ensurepip=install" ;install pip and setuptools
+ "--with-computed-gotos" ;main interpreter loop optimization
+ "--with-lto" ;increase size by 20MB, but 15% speedup
"--enable-unicode=ucs4"
+ "--enable-optimizations"
;; Prevent the installed _sysconfigdata.py from retaining a reference
;; to coreutils.
@@ -198,8 +201,13 @@
"ac_cv_file__dev_ptmx=no"
"ac_cv_file__dev_ptc=no")
'())
+ ;; -fno-semantic-interposition reinstates some optimizations by gcc
+ ;; leading to around 15% speedup. This is the default starting from
+ ;; python 3.10.
+ "CFLAGS=-fno-semantic-interposition"
(string-append "LDFLAGS=-Wl,-rpath="
- (assoc-ref %outputs "out") "/lib"))
+ (assoc-ref %outputs "out") "/lib"
+ " -fno-semantic-interposition"))
;; With no -j argument tests use all available cpus, so provide one.
#:make-flags
(list (string-append