ccache とは何か?
ccache は C と C++ に特化した compiler cache で、あるソースファイルが以前の実行と同じオブジェクトにコンパイルされることを検出し、そのオブジェクトを再利用します。前処理済みソース、コンパイラ、flag のハッシュを計算して cache キーを形成し、hit 時には保存された結果を提供します。ほとんどのファイルが変更されていない rebuild を劇的に高速化します。
なぜ重要か
大規模な C と C++ のプロジェクトは、rebuild の大半を変更されていないファイルの再コンパイルに費やします。ccache はそれらをほぼ即座の cache hit に変えます。CI 実行の間で ccache のディレクトリを永続化・復元することが、エフェメラルな runner で効果を発揮させる鍵です。関連する flag を無視する誤設定のキーは古いオブジェクトを生む可能性があるため、キーの正しさが重要です。
関連ガイド
What Is sccache?sccache is a compiler cache that stores compilation outputs, including in shared cloud storage, so repeated c…
What Is a Compiler Cache?A compiler cache stores the output of compiling a translation unit keyed on its inputs, so an identical compi…
What Is Incremental Linking?Incremental linking updates only the changed parts of an existing executable instead of relinking the whole b…