C Link time optimization & parallelism

The ThinLTO now selectable for builds like firefox, thunderbird , chromium and others uses a lot of time on the optimization phase.
the LLD running the optimization seems to use only 4 vcpu/threads even though I have an core i7-11700K cpu with 8 cores installed.
so the LLD optimization phase utilizes the system at roughly 25 %

ld(1) man page says

--thinlto-jobs=value
Number of ThinLTO jobs.

so it should be possible to do

LDFLAGS+= -thinlto-jobs=8

or similar .

View: https://www.youtube.com/watch?v=p9nH2vZ2mNo&t=130s


The developer doe not say that there is a limit to the concurrent optimization processes.
 
Try LDFLAGS += -Wl,--thinlto-jobs=${MAKE_JOBS_NUMBER} in the port Makefile (untested). If this works well, it might be a candidate for adding to the framework...
 
When I tried LTO (on Linux)
  • It made binary analysis of the object files a nightmare
  • There was a small reduction in the final executable size
  • No measurable performance gain
Check that you are getting gains before settling on using LTO.
 
Back
Top