Skip to content
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.

Performance

Tilo Wiedera edited this page Dec 16, 2016 · 2 revisions

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.

Use direct mode

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.

Use hardlinking

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.

Use 'clcachesrv'

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.

Avoid (live) virus scanning of the cache directory

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.

Store the cache directory on a low latency device

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.