Skip to content
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

Avoid recompiling WASM bytecodes #749

Merged
merged 2 commits into from
May 19, 2023

Conversation

jvff
Copy link
Contributor

@jvff jvff commented May 18, 2023

Motivation

WasmApplication only stored the bytecodes for the application, which meant that it recompiled them for every execution. This is inefficient.

Solution

Store the compiled Module (together with the required Engine instance) in WasmApplication.

Related Work

Part of #739
Closes #750 by including it

@jvff jvff added this to the Local testnet milestone May 18, 2023
@jvff jvff self-assigned this May 18, 2023
@jvff jvff marked this pull request as ready for review May 18, 2023 22:07
@jvff jvff requested a review from ma2bd May 18, 2023 22:07
Copy link
Contributor

@ma2bd ma2bd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving because it seems to improve performances and the current situation with #633.

I tried to remove the (partial) workaround with one more commit here: #750 (feel free to cherry-pick)

On my laptop, I couldn't trigger the issue any more (as opposed to removing the workaround on the main branch).

This being said, this PR doesn't quite minimize compilation costs (#739) yet because a bytecode could be shared between several applications. Also, I suspect we could avoid remembering engines with "headless engine" + "module serialization" concepts: https://docs.rs/wasmer/3.1.1/wasmer/struct.Engine.html#method.headless

linera-execution/src/wasm/wasmer.rs Outdated Show resolved Hide resolved
@jvff jvff force-pushed the cache-compiled-wasm-modules branch from bcfbc75 to d8dbd5b Compare May 19, 2023 11:36
jvff and others added 2 commits May 19, 2023 12:49
Avoid recompiling bytecodes for every execution of the same application.
@jvff jvff force-pushed the cache-compiled-wasm-modules branch from d45f48f to aef4dd0 Compare May 19, 2023 12:50
@jvff jvff merged commit aef4dd0 into linera-io:main May 19, 2023
3 checks passed
@jvff jvff deleted the cache-compiled-wasm-modules branch May 19, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants