Reputation: 43
my first question here (sorry for the possible misplacing) : what are all the files in /tmp/cache/bootsnap-compile-cache of a new rails application (256 directories, 1403 files, 28,2 MiB) ? Are they necessary or can I delete them all ?
Thanks.
Upvotes: 4
Views: 2554
Reputation: 1134
Short answer: You are safe to delete the /tmp/cache/bootsnap-compile-cache.
Long answer: Bootsnap, as I'm sure you're aware, is a Ruby library that optimizes and caches expensive computations, meaning you can boot Ruby/Rails applications faster.
One of the strategies Bootsnap employs to speed up your application is known as Compilation Caching.
Ruby has to translate ruby source into internal bytecode, which the VM then executes. What Bootsnap does is cleverly cache a bunch of these translations in cache files that consist of headers and cache contents (these are the files stored under the directory in question). This is done so that when your application performs its various operations, it can simply to do a lookup on the already-translated bytecode cached by Bootsnap, instead of performing the relatively-expensive compilation step, thus making the code execute faster.
A readable implementation of this concept can be found here
As you might have guessed by now, deleting those files will simply mean your application runs a little slower locally, until the operations are subsequently cached once more.
Unfortunately, to the best of my knowledge, there is currently no automatic purging mechanism for Bootsnap's cache. The library leaves cleaning up the cache up to the user (a la assets:clean
or container pruning).
Hope that helps!
Upvotes: 10