-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Added support ccache for speedup compilation on Linux #14173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I did not measure CI build speed, I was interested in local build on computer. |
|
A complete rebuild takes 2m12s on my 2019 laptop. Do we really need to add complexity to this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've already been using ccache for years (I have /usr/lib/ccache/bin/ in my $PATH), and I consider it essential. Waiting minutes at rebuilding each time you checkout a different branch is awful.
=> I support this.
Please add a build option to enable this. One might still want to compile without ccache every now and then, e.g. for benchmarking build speed.
Probably not. The cached build artifacts needs to be stored somewhere, you won't get this without modifying the CI stuff. |
|
What's the benefit of making changes to our Maybe we should just recommend |
Do you suggest entering -D parameter every time? I think most people will forget. |
This is just needed at "configure time", e.g. when invoking And if people do "forget" to use (BTW, I removed the linked issue, since that concerned CI, and this PR does not make necessary CI changes.) |
|
A simple Either way, we should have some doc explaining how one can compile minetest with ccache. |
(Nitpick: The C files aren't really relevant for performance. We have only one C file ( What I like about Anyways, if it's such a trivial shorthand I wouldn't mind; there is virtually no risk in merging that, though I'd be wary of a default of
Agreed. |
|
The option is still missing. |
|
I found my way here after plumbing ccache into the CMakeLists.txt here because I had a release-mode crash that I wanted to debug in CMAKE_BUILD_TYPE=Debug mode. Having said that, I do understand that for CI/CD builds it is often not practical to manage the cache state, so it's more optional in practice, unless you're optimizing for cost, turn-around time or throughput at scale. But for interactive development and iteration, highly recommended by default, never personally seen it fail in practice. Here are some timings on my machine using ccache: If there is anything further needed to "make the case for ccache", happy to engage with that. |
|
I have ccache installed and it's extremely useful for Luanti development but I'm surprised that you would expect build system to pick it up and enable by default. I have never noticed that being the case with other projects. |
|
Perhaps it's the build automation perspective. If you do want to build every push to every branch, it's nice to have the answer (compiler error, link error, test failure) as soon as possible. If I've broken Android, or ARM, that's what the CI/CD robot is there to catch while it's still reasonably fresh in my mind. I guess I'm too lazy to opt in to something that seems like it ought to be the default. (On Linux, at least) |
|
Using ccache in CI is a different PR: #13111 There are tradeoffs involved here. Such a cache takes space (not everyone has plenty of that), and it can fail (and ccache or not, there have definitely been instances where a full rebuild fixed a problem). I would not expect such a cache to be enabled by default just because I have the relevant program installed. I would want to (and currently do) explicitly opt in. I'm lazy too but passing a couple command-line arguments when configuring is very much acceptable. |
|
Some things I'd mention in favour of ccache by default, for Linux at least.
So as a demonstration for luanti on a 24-core AMD Ryzen 9 7900 with a pre-warmed cache Building with ccache: And without: This is a relatively strong CPU on a new system. |
|
I don't see the benefit of using ccache in the cmakelists by default:
Someone should just add mention of ccache here: https://docs.luanti.org/for-engine-devs/compiling/improving-build-times/ |
@sfan5 more information:
https://ccache.dev/
https://en.wikipedia.org/wiki/Ccache