Skip to content

Commit

Permalink
[no ci] Optimise release builds
Browse files Browse the repository at this point in the history
  • Loading branch information
ThetaSinner committed Apr 12, 2024
1 parent 0160506 commit 3fcc091
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions checked_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,11 @@ unused_import_braces = "warn"
unused_lifetimes = "warn"
unused_macro_rules = "warn"
unused_qualifications = "warn"

# At the time of adding, these took the binary size from 23MB to 8.3Mb. Still big but better.
[profile.release]
strip = true
opt-level = "z"
lto = true
codegen-units = 1
panic = "abort"
3 changes: 2 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@
nodejs_20
minisign
libsodium
lcov
upx # For binary size optimisation. Not currently working with `checked_cli`, try again later
binaryen # For wasm-opt, optimising wasms before packaging
];

shellHook = ''
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"network:tauri": "hc s clean && npm run build:happ && UI_PORT=8888 concurrently \"npm start -w ui\" \"npm run launch:tauri\" \"echo 'Not running holochain-playground'\"",
"launch:tauri": "concurrently \"hc run-local-services --bootstrap-port $BOOTSTRAP_PORT --signal-port $SIGNAL_PORT\" \"echo pass | RUST_LOG=warn hc launch --piped -n $AGENTS workdir/checked.happ --ui-port $UI_PORT network --bootstrap http://127.0.0.1:\"$BOOTSTRAP_PORT\" webrtc ws://127.0.0.1:\"$SIGNAL_PORT\"\"",
"package": "npm run build:happ && npm run package -w ui && hc web-app pack workdir --recursive",
"build:happ": "npm run build:zomes && hc app pack workdir --recursive",
"build:happ": "npm run build:zomes && find ./target/wasm32-unknown-unknown/release/*.wasm | xargs -I '{}' wasm-opt '{}' -O2 --output '{}' && hc app pack workdir --recursive",
"build:zomes": "RUSTFLAGS='' CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown",
"lint": "npm run -w ui lint && npm run -w tests lint && cargo clippy && cargo clippy --manifest-path ./checked_cli/Cargo.toml",
"format": "npm run -w ui format && npm run -w tests format && cargo fmt && cargo fmt --manifest-path ./checked_cli/Cargo.toml"
Expand Down

0 comments on commit 3fcc091

Please sign in to comment.