Skip to content

Commit

Permalink
chore(query-engine-wasm-api): update Wasm, enable externalref
Browse files Browse the repository at this point in the history
  • Loading branch information
jkomyno committed Aug 8, 2023
1 parent bcfaed8 commit 6156e72
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 162 deletions.
14 changes: 13 additions & 1 deletion query-engine/js-connectors/js/smoke-test-js/src/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ To optimize the Wasm binary, run:
# --minify-imports: Minify import names
# --remove-non-js-ops: Remove non-JS operations
# --duplicate-function-elimination: Eliminate duplicate functions
# --vacuum: Removes obviously unneded code
# --disable-threads: Disable atomic operations
# --enable-reference-types: Enable reference types
# --directize: turns indirect calls into direct ones
# --cfp: propagate constant structure field values
# --local-cse: local common subexpression elimination inside basic blocks
WASM_FILE="./target/wasm32-unknown-unknown/release/libquery_wasm.wasm" \
wasm-opt $WASM_FILE \
-Os \
Expand All @@ -30,6 +36,12 @@ WASM_FILE="./target/wasm32-unknown-unknown/release/libquery_wasm.wasm" \
--minify-imports \
--remove-non-js-ops \
--duplicate-function-elimination \
--vacuum \
--disable-threads \
--enable-reference-types \
--directize \
--cfp \
--local-cse \
-o $WASM_FILE
```

Expand All @@ -38,7 +50,7 @@ The resulting Wasm binary should be around 4.1MB.
Then, run

```bash
wasm-bindgen --target bundler --out-dir ./query-engine/js-connectors/js/smoke-test-js/src/wasm ./target/wasm32-unknown-unknown/release/libquery_wasm.wasm
wasm-bindgen --target bundler --reference-types --out-dir ./query-engine/js-connectors/js/smoke-test-js/src/wasm ./target/wasm32-unknown-unknown/release/libquery_wasm.wasm
```

TODO: evaluate using `wasm-pack`.
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ import * as wasm from "./libquery_wasm_bg.wasm";
import { __wbg_set_wasm } from "./libquery_wasm_bg.js";
__wbg_set_wasm(wasm);
export * from "./libquery_wasm_bg.js";

wasm.__wbindgen_start();
Loading

0 comments on commit 6156e72

Please sign in to comment.