mange
mange2w ago

where does `deno compile` place the V8 code cache?

In Deno 2.1 it was added a V8 code caching for faster startups when running a binary produced with deno compile. I have a setup where I use deno compile with Docker to have a minimal alpine image that just runs the compiled binary in the end. How could I make sure to get this cache created at the inital run of the binary to improve the startup time of the Docker container? I'm thinking that using a multi stage Dockerfile where I build and run the deno compiled binary and then copy that and the V8 code cache over to a bare alpine image would give me the best startup time. So basically, where is this V8 code cache stored?
No description
4 Replies
bartlomieju
bartlomieju2w ago
It's in a temp directory, you might want to follow https://github.com/denoland/deno/issues/26980
GitHub
deno compile --code-cache-path · Issue #26980 · denoland/deno
With the new code cache, compiled programs would end up writing to ~/.cache/deno. This may not be desirable. The program may have its own cache directory for example. Also, it would end up creating...
mange
mangeOP2w ago
@bartlomieju thanks for the link. I will follow it. Still quite confusing though as they mention the temporary folder beeing in ~/.cache/deno and also that it is a temporary file. When I run my binary (compiled with deno 2.1.1) I neither find any cache in ~/.cache/deno or any new folder in my /tmp folder.
bartlomieju
bartlomieju2w ago
The things in ~/.cache/deno are regular Deno caches for things like module analysis, they are not required for deno compile binaries. Try compiling with deno compile --log-level debug - there will be some information if cache was used or rejected for some reason
mange
mangeOP2w ago
Thanks for the tip, I will try this.