Using ccache with Visual Studio and TrackFileAccess #1355
-
I started using ccache with my fairly large cmake project in order to speed up compile time. I followed the guide and settings at https://github.com/ccache/ccache/wiki/MS-Visual-Studio and it's all working pretty well. Compile times after clean and between builds on the build server are greatly improved. The only annoyance I have is that if I change a single file and want to run my application (or don't change anything at all) then it has to execute ccache on every .cpp. This is significantly faster than if it were actually compiling each file, but not anywhere close to the speed that visual studio looks up the cache to determine if it needs to recompile. What used to be a second or two may be a minute or more now. The issue is caused by the recommendation to set TrackFileAccess=false. I'm just curious why that is the recommendation and is there any harm in setting it back to true? I get that by setting it to true there's some overlap where VS and ccache are both trying to look up the cached output. Does this really cause any harm though other than a potential performance hit in the case of VS not having it cached? I can't imagine the performance hit is very big though since VS seems to be very fast with its lookup. The other scenarios I don't think would cause any real harm. VS may think that it needs to be recompiled so ccache gets called and ccache thinks it's already compiled so it just returns the cached output. Or VS doesn't think it needs to be recompiled so ccache doesn't get called and the VS cached output gets used (which previously came from ccache anyway). Is there anything I'm not thinking of or any other reason not to enable it? For reference I just timed it both ways and a project with 289 .cpp files took: This makes for a difference of 72.14 seconds or ~250ms per cpp file. For my project this is just 1 shared library dependency which makes up less than half of the overall project size. Taking several minutes after making a minor change is far from ideal for development which is why I want to turn it back on. If it increases our build time by a small amount then that's a reasonable tradeoff as far as I'm concerned. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
As I understand it, it's to tell Visual Studio not to remove ccache's cached files when cleaning the project. See also #1140. |
Beta Was this translation helpful? Give feedback.
As I understand it, it's to tell Visual Studio not to remove ccache's cached files when cleaning the project. See also #1140.