@blackout i know how to optimize but somebody don't know about and this was a hint because the linker can also run in parallel processes with -flto=auto
-flto=auto
can replace ltoflags+="=$(getconf _NPROCESSORS_ONLN)
in ZZ-lto.sh.in
Git Clone URL: | https://aur.archlinux.org/makepkg-optimize.git (read-only, click to copy) |
---|---|
Package Base: | makepkg-optimize |
Description: | Supplemental build and packaging optimizations for makepkg |
Upstream URL: | https://wiki.archlinux.org/index.php/Makepkg-optimize |
Licenses: | GPL |
Submitter: | quequotion |
Maintainer: | quequotion |
Last Packager: | quequotion |
Votes: | 18 |
Popularity: | 0.21 |
First Submitted: | 2016-03-20 15:08 (UTC) |
Last Updated: | 2022-01-09 15:05 (UTC) |
@blackout i know how to optimize but somebody don't know about and this was a hint because the linker can also run in parallel processes with -flto=auto
-flto=auto
can replace ltoflags+="=$(getconf _NPROCESSORS_ONLN)
in ZZ-lto.sh.in
@brikler you have to understand the package. check ZZ-lto.sh.in makeflags.conf
after installation you have to check the makepkg.conf and you have the optimizations commented out. so you can replace your original file with the optimizations.
RTM
if found this options perhaps it is interesting for makepkg-optimize?
If you specify the optional n, the optimization and code generation done at link time is executed in parallel using n parallel jobs by utilizing an installed make program. The environment variable MAKE may be used to override the program used.
You can also specify -flto=jobserver to use GNU make’s job server mode to determine the number of parallel jobs. This is useful when the Makefile calling GCC is already executing in parallel. You must prepend a ‘+’ to the command recipe in the parent Makefile for this to work. This option likely only works if MAKE is GNU make. Even without the option value, GCC tries to automatically detect a running GNU make’s job server.
Use -flto=auto to use GNU make’s job server, if available, or otherwise fall back to autodetection of the number of CPU threads present in your system.
@quequotion: I saw this first in Alads commit that strips parallel
off of aur-srcver
particular this line showing wait -n
usage.
Fix the case statement in upx
and add multiprocessing
to upx
optipng
and svgo
git am < <(curl -s 'https://github.com/bartoszek/AUR-makepkg-optimize/commit/f1964eb728aee09524357d58585037b18ea50725.patch')
Inspired by aurutils
pacman=5.2
just landed in [core]
, you can update depends[]
@brikler
Finally had a chance to test this in the wild; checking $CC
and $CXX
only really works if they are set in makepkg.conf. Packages (see pcsx2-git) may set them in build()
, after the libmakepkg scripts have run; the only solution seems to be having distinct options for gcc and clang; ie lto-clang
and lto-thin-clang
...
EDIT: There are now separate options for clang: lto-clang, lto-thin-clang, polly, rice-clang. I'm having a heck of a time proving they work, but they should. polly
will not, because it requires the polly package for llvm, which is only available in llvm-git (aur).
@brikler
You still need to follow the instructions on the wiki to enable the clang compiler (set CC
and CXX
, etc), but ZZ-lto.sh.in will now set the appropriate flags depending on which compiler you have enabled.
I've also added a new build environment option lto-thin. This does -flto=thin
for clang or uses the default behavior for gcc (formerly -fwhopr
).
The build environment option lto will do monolithic link time optimization for both; this can result in greater optimization, but requires greater resources and takes more time.
I looked into the compatibility of the pgo build environment option's flags, and it seems like they should be fine as is; clang claims to support the gcc flags in addition to its own.
@quequotion i don't know how makepkg decide the compiler to use but it should be possible to catch this choice before the compiler works because some packages where compiled with clang by default, as example mesa
Pinned Comments
quequotion commented on 2019-02-27 07:49 (UTC) (edited on 2022-01-09 13:20 (UTC) by quequotion)
makepkg-optimize is a collection of libmakepkg tidy, buildenv, and executable extensions, and a supplement to pacman. These enable various optimization routines for building and packaging such as upx compression, profile guided optimization, polyhedral model optimization, etc..
Note: Over-optimization is a thing, and it is not good.
See the wiki article for details.
Note to packagers: makepkg-optmize's macros may be enabled or disabled in options() as well!