Speed up the module cache 6x by removing LZW compression #4031
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
While troubleshooting slow start times for
wasmer run
, we noticed that using LZW compression when caching compiled modules to the filesystem (wasmer_wasix::runtime::module_cache::FileSystemCache
) incurs about a very noticeable 6x performance penalty.For perspective, compiling php.wasm with cranelift took about 4.75 seconds on a M1 Mac.
Without LZW compression:
FileSystemCache::save()
: 408ms, 142MB binaryFileSystemCache::load()
: 155msWith LZW compression:
FileSystemCache::save()
: 2.4s, 72MB binaryFileSystemCache::load()
: 822msCheck out the conversation on Slack for more context.