-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to get and load compilation result bytes #1779
Comments
Subscribe to Label Actioncc @peterhuene
This issue or pull request has been labeled: "wasmtime:api"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
Thanks for the report, and seems like a reasonable feature to add to me! I think for us the APIs this might look like are: impl Module {
pub fn deserialize_cache_bytes(store: &Store, bytes: &[u8]) -> Result<Module>;
pub fn serialize_cache_bytes(&self) -> Vec<u8>;
} (or something like that) Our cache format is not currently where we want it to end up. One aspect we'd like for the caches eventually is that you can "mmap and go" with zero changes to what's mmap'd in, but we can probably implement that with something like In any case @dsherret would you be willing to work on adding this feature? |
@alexcrichton that API looks perfect to me. How much work do you think it would be? Is it just hooking up a few things internally to that public api? If so, then sure! I'm actually not using wasmtime at all, but was just evaluating it and this was a blocker for me. |
I think this may be somewhat nontrivial to implement because the code isn't well-structured this way today. Our core caching function would need to be updated to optionally have bytes passed in, or otherwise refactored elsewhere to have "get the bytes" refactored into a separate step. Overall I don't think it'll be too too difficult of a change, but it will require some refactoring and isn't a simple "just connect the wires" sort of change. |
@alexcrichton thanks for pointing me in the direction of the code. I took a look at it briefly and you're right that it would be a bit non-trivial, but overall doesn't look too bad. I'm currently dragging my head through the sand with an access violation bug so my brain is kind of fried. I'll maybe come back to this later if I don't make any progress otherwise and want to try using wasmtime... (I'd like to support this project as I really like the idea behind it). |
@yurydelendik sorry, I meant to respond. I looked at the public api earlier and it looked good to me! Thanks! I'm not using wasmtime at the moment though. |
Feature
It would be useful to be able to get the bytes from a compilation result and additionally take bytes from a previous compilation and load them into a module.
Benefit
This would allow me to manage my own caching and reduce startup times.
Implementation
Here's how it's done in wasmer.
Compiling:
Loading:
Alternatives
Using the
Config::cache_config_load_default
is not ideal because it's wasmtime managing a cache for me and it seems I need to keep the.wasm
file bytes around.The text was updated successfully, but these errors were encountered: