-
Notifications
You must be signed in to change notification settings - Fork 83
Performance
The primary purpose of clcache is to make things faster. However, there are various aspects on how support or deter clcache from achieving this goal. This page collects a couple of performance related tips to keep in mind when trying to get the most out of it.
This one is easy, and it's actually the default: if possible, try to avoid using the CLCACHE_NODIRECT
environment variable which enables the "classic" mode of operation involving calling the preprocessor to test for potentially cached object files. It is slower than the 'direct' mode.
In case the cache directory is on the same drive as the build directory (i.e. object files don't need to be copied across different drives), consider setting the CLCACHE_HARDLINK=1
environment variable. This will avoid that clcache copies files from the cache to the build directory. Instead, hard links are created - which is faster and reduces disk usage. This is especially useful on mechanical drives which typically are a lot slower than SSDs.
clcache -- especially for builds which cause a lot of cache hits -- spends a lot of time calculating hash sums of files. To avoid redoing this work over and over, it's much recommended to launch the clcachesrv
server program and then use the CLCACHE_SERVER=1
environment variable to make clcache use the server. The two programs will then communicate, causing clcachesrv
to compute (and cache!) hash sums.
Some users reported abysmal performance of clcache, and in one case this was caused by an overly zealous virus scanner slowing down any file I/O. In case the performance seems suboptimal, try disabling the anti virus software (or adding an exception for the cache directory) to see whether it helps.
The cache used by clcache typically consists of a lot of files, none of which being typically large. Hence, it's important to have quick random access times and little latency. For that reason, it's often not a good idea to try using a network share. On the other hand, even a plain USB stick can work rather well since flash storage typically has low latency.