https://github.com/streamdal/wasm
https://github.com/streamdal/wasm
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/streamdal/wasm
- Owner: streamdal
- License: apache-2.0
- Created: 2023-07-05T21:49:30.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-12T03:18:15.000Z (over 2 years ago)
- Last Synced: 2023-12-12T04:26:37.144Z (over 2 years ago)
- Language: Rust
- Size: 9.58 MB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Wasm
====
[](https://github.com/streamdal/wasm/actions/workflows/release.yml)
[](https://github.com/streamdal/wasm/actions/workflows/pr.yml)
# [THIS REPO HAS MOVED!](https://github.com/streamdal/mono)
This repository contains all of the Wasm funcs used by various
[Streamdal](https://github.com/streamdal/streamdal) components.
To build: `make build`
Build artifacts are placed in `./build/*`.
To test: `make test`
Releases are automatically tagged on merge to `main`.
## Wasm Artifact Size
Close to 50% size reduction is achieved by using `lto = true` in `Cargo.toml`.
As per [this doc](https://rustwasm.github.io/docs/book/reference/code-size.html),
this tells LLVM to inline and prune functions which improves both speed and size.
We get another 15-20% reduction by using `wasm-opt` (with `Os` flag).
Result is as follows:
```bash
~/Code/streamdal/wasm/build main* ⇡ 2h41m ✖ ⚑ ◒
❯ du -sh *
1.9M detective.lto+wasm-opt.wasm
2.4M detective.lto-only.wasm
```
Without any of the size optimizations, the initial binary size is ~4.2MB.
Compile + optimization time is ~45s on an M2.
## Developing
To update protobuf definitions across all modules, run `bash update_protos.sh 1.2.3`. This will replace the
version of `streamdal-protos` across all `Cargo.toml` files and run a `cargo update` to pull in the new version.
## Release
Releasing is semi-automatic - you have to manually create and push a new `v0.0.0`
tag and Github Actions will pick up the commit and create a new release.
```
git tag v0.0.4
git push --tags
```