cake icon indicating copy to clipboard operation
cake copied to clipboard

Support for linking object files into object cache rather than copying them

Open lewissbaker opened this issue 9 years ago • 0 comments

When using the object-file cache we could use file-system linking to avoid copying unnecessarily, either when adding files to the cache or retrieving files from the cache. This can help to reduce build times and also reduce disk space usage.

Where hard-linking is supported and the cache directory is on the same volume as the built object-file we could hard-link the cached file to the same file as the built object-file. This would eliminate a copy operation when inserting objects into the cache and when the built object-file is removed the cache copy would still remain available.

Where symbolic-linking is supported and we want to use an object file from the cache, we could create a symbolic link to the object file in the cache directory rather than copying the file from the cache directory into its final destination.

Both of these linking approaches would come with the caveat that the build should not modify the object files after they have been built. We could possibly enforce this if linking was enabled by setting the file permissions to read-only.

lewissbaker avatar Jan 18 '15 10:01 lewissbaker