Stream: wasmtime

Topic: ✔ Disable caching


view this post on Zulip Michiel Van Kenhove (imec-UGent) (Jul 10 2025 at 16:48):

In older versions of wasmtime, we could easily disable caching by setting enabled = false in the config.toml file. This was updated in v33.0.0.

Now looking at the docs, it is not clear how to disable caching when using the wasmtime CLI. According to https://docs.rs/wasmtime/latest/wasmtime/struct.Config.html#method.cache it seems that newly created configs should have caching disabled by default? But our testing shows that it is still enabled even with an empty config file.

Running a certain wasm module for the first time takes around 0.23 seconds, subsequent runs take about 0.07 seconds. The caching directory is also created after the first run.

ubuntu@benchmarkb:/tmp$ ls -la ~/.config/
total 12
drwx------  3 ubuntu ubuntu 4096 Jul 10 18:42 .
drwxr-x--- 13 ubuntu ubuntu 4096 Jul 10 18:30 ..
drwx------  2 ubuntu ubuntu 4096 Jul  9 22:36 procps
ubuntu@benchmarkb:/tmp$ ls -la ~/.cache/
total 12
drwx------  3 ubuntu ubuntu 4096 Jul 10 18:42 .
drwxr-x--- 13 ubuntu ubuntu 4096 Jul 10 18:30 ..
drwxrwxr-x 19 ubuntu ubuntu 4096 Jul  4 10:57 ccache
-rw-r--r--  1 ubuntu ubuntu    0 Jul  4 10:22 motd.legal-displayed
ubuntu@benchmarkb:/tmp$
ubuntu@benchmarkb:/tmp$ wasmtime config new
Successfully created a new configuration file at '/home/ubuntu/.config/wasmtime/config.toml'.
ubuntu@benchmarkb:/tmp$ cat ~/.config/wasmtime/config.toml
# Comment out certain settings to use default values.
# For more settings, please refer to the documentation:
# https://bytecodealliance.github.io/wasmtime/cli-cache.html

[cache]
ubuntu@benchmarkb:/tmp$
ubuntu@benchmarkb:/tmp$ /usr/bin/time wasmtime funky-kart.wasm
0.67user 0.06system 0:00.23elapsed 309%CPU (0avgtext+0avgdata 91180maxresident)k
0inputs+4272outputs (0major+29045minor)pagefaults 0swaps
ubuntu@benchmarkb:/tmp$
ubuntu@benchmarkb:/tmp$ ls -la ~/.cache/
total 16
drwx------  4 ubuntu ubuntu 4096 Jul 10 18:43 .
drwxr-x--- 13 ubuntu ubuntu 4096 Jul 10 18:30 ..
drwxrwxr-x 19 ubuntu ubuntu 4096 Jul  4 10:57 ccache
-rw-r--r--  1 ubuntu ubuntu    0 Jul  4 10:22 motd.legal-displayed
drwxrwxr-x  3 ubuntu ubuntu 4096 Jul 10 18:43 wasmtime
ubuntu@benchmarkb:/tmp$
ubuntu@benchmarkb:/tmp$ /usr/bin/time wasmtime funky-kart.wasm
0.05user 0.02system 0:00.07elapsed 100%CPU (0avgtext+0avgdata 29668maxresident)k
0inputs+8outputs (0major+6558minor)pagefaults 0swaps
ubuntu@benchmarkb:/tmp$ /usr/bin/time wasmtime funky-kart.wasm
0.06user 0.01system 0:00.07elapsed 100%CPU (0avgtext+0avgdata 29672maxresident)k
0inputs+8outputs (0major+6560minor)pagefaults 0swaps
ubuntu@benchmarkb:/tmp$

What is (if possible?) the new way to disable caching entirely when using the CLI? We need this to effectively compare JIT vs. AOT.

view this post on Zulip Alex Crichton (Jul 10 2025 at 16:50):

Disabling via the cli can be done with -Ccache=n but it's true that 33 changed that you can't have a config file itself disable caching. If that's desired though we can add that back in.

FWIW the documentation on Config is accurate, but the CLI switches some defaults such as for caching

view this post on Zulip Notification Bot (Jul 10 2025 at 16:55):

Michiel Van Kenhove (imec-UGent) has marked this topic as resolved.


Last updated: Dec 06 2025 at 06:05 UTC