Skip to content

Commit a0a5963

Browse files
authored
build: enable bulk memory operations in wasm (#173)
This is supported (and enabled by default) in wasmtime, and should increase actor performance.
1 parent caed42c commit a0a5963

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

build.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ const ACTORS: &[(&Package, &ID)] = &[
2525
("verifreg", "verifiedregistry"),
2626
];
2727

28+
const WASM_FEATURES: &[&str] = &["+bulk-memory", "+crt-static"];
29+
2830
const NETWORK_ENV: &str = "BUILD_FIL_NETWORK";
2931

3032
/// Returns the configured network name, checking both the environment and feature flags.
@@ -90,6 +92,10 @@ fn main() -> Result<(), Box<dyn Error>> {
9092
println!("cargo:rerun-if-changed={}", file);
9193
}
9294

95+
let rustflags =
96+
WASM_FEATURES.iter().flat_map(|flag| ["-Ctarget-feature=", *flag, " "]).collect::<String>()
97+
+ "-Clink-arg=--export-table";
98+
9399
// Cargo build command for all actors at once.
94100
let mut cmd = Command::new(&cargo);
95101
cmd.arg("build")
@@ -98,7 +104,7 @@ fn main() -> Result<(), Box<dyn Error>> {
98104
.arg("--profile=wasm")
99105
.arg("--locked")
100106
.arg("--manifest-path=".to_owned() + manifest_path.to_str().unwrap())
101-
.env("RUSTFLAGS", "-Ctarget-feature=+crt-static -Clink-arg=--export-table")
107+
.env("RUSTFLAGS", rustflags)
102108
.env(NETWORK_ENV, network_name)
103109
.stdout(Stdio::piped())
104110
.stderr(Stdio::piped())

0 commit comments

Comments
 (0)