Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can ccache reduce llvm compiling?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
ImErina
n00b
n00b


Joined: 10 Feb 2022
Posts: 51

PostPosted: Fri Jun 16, 2023 9:15 am    Post subject: Can ccache reduce llvm compiling? Reply with quote

When installing llvm, clang, compiler-rt, libclc and so, a lot of things are compiled several times. With
Code:
hash_dir = false
in ccache.conf, can it reduce the times of compilation between these packages?
Back to top
View user's profile Send private message
ImErina
n00b
n00b


Joined: 10 Feb 2022
Posts: 51

PostPosted: Sat Jun 17, 2023 12:36 am    Post subject: Reply with quote

A quick test shows that is it possibly cannot.

Here's what ccache says after building llvm, clang, libclc.

Code:

Cacheable calls:   5855 / 6446 (90.83%)
  Hits:             212 / 5855 ( 3.62%)
    Direct:          79 /  212 (37.26%)
    Preprocessed:   133 /  212 (62.74%)
  Misses:          5643 / 5855 (96.38%)
Uncacheable calls:  591 / 6446 ( 9.17%)
Local storage:
  Cache size (GB):  0.3 / 25.0 ( 1.22%)
  Hits:             212 / 5855 ( 3.62%)
  Misses:          5643 / 5855 (96.38%)


So how exactly does ccache works? What does it take into account for generating a hash?
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22602

PostPosted: Sat Jun 17, 2023 12:54 am    Post subject: Reply with quote

According to How ccache works (ccache manual):
Code:
The detection is done by hashing different kinds of information that should be unique for the compilation and then using the hash sum to identify the cached output.
...
The following information is always included in the hash:

    the extension used by the compiler for a file with preprocessor output (normally .i for C code and .ii for C++ code)

    the compiler’s size and modification time (or other compiler-specific information specified by compiler_check)

    the name of the compiler
...
In the preprocessor mode, the hash is formed of the common information and:

    the preprocessor output from running the compiler with -E
...
I omitted the parts unlikely to be relevant to your question, but you can see them at the linked document.
Back to top
View user's profile Send private message
Ginta
Apprentice
Apprentice


Joined: 17 Feb 2006
Posts: 152
Location: Spain

PostPosted: Sat Jun 17, 2023 1:08 pm    Post subject: Reply with quote

Ccache is proven to be useful only on rebuilds (ebuild testing, emerge -e world, manual reinstall, etc) but not on new installs.

Also, some USE changes alter internal constants so it renders the cache invalid again.

So unless you do a lot of same or nearly same scenario recompiles ccache is not helping.
_________________
Some people should use emerge brain on theirselves...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum