Bug 246245 - Mk/bsd.ccache.mk: Increase ccache hit ratio
Summary: Mk/bsd.ccache.mk: Increase ccache hit ratio
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Port Management Team
URL: https://ccache.dev/manual/3.7.9.html#...
Keywords: needs-qa, performance
Depends on:
Blocks:
 
Reported: 2020-05-06 03:53 UTC by rozhuk.im
Modified: 2020-06-16 05:37 UTC (History)
4 users (show)

See Also:
koobs: exp-run?


Attachments
patch (721 bytes, patch)
2020-05-06 03:53 UTC, rozhuk.im
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description rozhuk.im 2020-05-06 03:53:24 UTC
Created attachment 214185 [details]
patch

Make ccache more efficient.
https://ccache.dev/manual/3.7.9.html#_compiling_in_different_directories

Port system builds every port in folders with different names, this broke ccache hit ratio.
With this patch last chromium update take ~20 minutes, not 1 hour 30 minutes as usual.
Comment 1 Sunpoet Po-Chuan Hsieh freebsd_committer 2020-05-06 15:44:42 UTC
Assign PR to the maintainer.
Comment 2 Bryan Drewery freebsd_committer 2020-06-15 17:07:04 UTC
Yes this patch makes sense. I haven't tested it though.
Comment 3 Mathieu Arnold freebsd_committer 2020-06-15 17:35:06 UTC
Do we need an exp-run because of the CFLAGS change?
Comment 4 Bryan Drewery freebsd_committer 2020-06-15 17:40:47 UTC
(In reply to Mathieu Arnold from comment #3)

It wouldn't hurt. I do worry that it will regress some ports that somehow see
the MAKE_ENV but don't care about CFLAGS passed in. Not worth blocking it on those though as they are already losing all caching on version bumps due to changed workdir name.
Comment 5 dewayne 2020-06-16 02:15:13 UTC
(In reply to Bryan Drewery from comment #4)
The proposed CFLAG change option isn't available in the man pages of clang nor gcc9, so the begging question is: how will this change affect those that have a development/debugging environment.  (Hopefully none).  

Conversely for those that turn off debugging in their CFLAGS (-g0), does this option become a noop?  (I'm afraid that I'm overly cautious when something may be added to binaries)
Comment 6 rozhuk.im 2020-06-16 03:44:15 UTC
(In reply to dewayne from comment #5)

-fdebug-prefix-map=${WRKSRC}=. - documented option.
https://gcc.gnu.org/install/configure.html
https://manpages.debian.org/experimental/binutils-common/as.1.en.html

Then some one make debug build in backtrace or whatever then will see main.c not /tmp/ports/***/***/someapp-1.33.55/main.c.
This allow ccache to cache files even then path to file changed.
In our port system path changed on app version update.
Comment 7 dewayne 2020-06-16 04:10:41 UTC
(In reply to rozhuk.im from comment #6)
Thank-you.  After reviewing your references and poking around in 
# find /usr/src/ | xargs grep debug-prefix-map
files I can see little to be concerned. Cheers.