mirror of
https://gitlab.com/veilid/veilid.git
synced 2026-10-12 17:32:09 -05:00
optimizations
This commit is contained in:
1 parent
9922c4e719
commit
0836c3ab0f
9 files changed
+43
-37
No files matched your search
+28
-22
@@ -28,50 +28,56 @@ rust-version = "1.89.0"
|
||||
# keyvaluedb-sqlite = { path = "../keyvaluedb/keyvaluedb-sqlite" }
|
||||
# keyvaluedb-web = { path = "../keyvaluedb/keyvaluedb-web" }
|
||||
|
||||
# Size-optimized overall; crypto packages below stay at full opt for throughput. A package
|
||||
# override reaches only that package's own code: generic and #[inline] code is compiled
|
||||
# where it is instantiated, which is why veilid-core-optimized exists and is listed too.
|
||||
# Speed by default: every native binary (veilid-server, veilid-flutter) ships this.
|
||||
[profile.release]
|
||||
opt-level = "z"
|
||||
opt-level = 3
|
||||
lto = true
|
||||
panic = "abort"
|
||||
codegen-units = 1
|
||||
|
||||
[profile.release.package.veilid-core-optimized]
|
||||
# The wasm targets build with `--profile size`: what a browser downloads. Crypto and the
|
||||
# hot path stay at full opt. A package override reaches only that package's own code:
|
||||
# generic and #[inline] code is compiled where it is instantiated, which is why
|
||||
# veilid-core-optimized exists and is listed too.
|
||||
[profile.size]
|
||||
inherits = "release"
|
||||
opt-level = "z"
|
||||
|
||||
[profile.size.package.veilid-core-optimized]
|
||||
opt-level = 3
|
||||
[profile.release.package.curve25519-dalek]
|
||||
[profile.size.package.curve25519-dalek]
|
||||
opt-level = 3
|
||||
[profile.release.package.ed25519-dalek]
|
||||
[profile.size.package.ed25519-dalek]
|
||||
opt-level = 3
|
||||
[profile.release.package.x25519-dalek]
|
||||
[profile.size.package.x25519-dalek]
|
||||
opt-level = 3
|
||||
[profile.release.package.chacha20poly1305]
|
||||
[profile.size.package.chacha20poly1305]
|
||||
opt-level = 3
|
||||
[profile.release.package.chacha20]
|
||||
[profile.size.package.chacha20]
|
||||
opt-level = 3
|
||||
[profile.release.package.poly1305]
|
||||
[profile.size.package.poly1305]
|
||||
opt-level = 3
|
||||
[profile.release.package.blake3]
|
||||
[profile.size.package.blake3]
|
||||
opt-level = 3
|
||||
[profile.release.package.blake2]
|
||||
[profile.size.package.blake2]
|
||||
opt-level = 3
|
||||
[profile.release.package.sha2]
|
||||
[profile.size.package.sha2]
|
||||
opt-level = 3
|
||||
[profile.release.package.argon2]
|
||||
[profile.size.package.argon2]
|
||||
opt-level = 3
|
||||
[profile.release.package.cipher]
|
||||
[profile.size.package.cipher]
|
||||
opt-level = 3
|
||||
[profile.release.package.digest]
|
||||
[profile.size.package.digest]
|
||||
opt-level = 3
|
||||
[profile.release.package.crypto-common]
|
||||
[profile.size.package.crypto-common]
|
||||
opt-level = 3
|
||||
[profile.release.package.generic-array]
|
||||
[profile.size.package.generic-array]
|
||||
opt-level = 3
|
||||
[profile.release.package.hpke]
|
||||
[profile.size.package.hpke]
|
||||
opt-level = 3
|
||||
[profile.release.package.hkdf]
|
||||
[profile.size.package.hkdf]
|
||||
opt-level = 3
|
||||
[profile.release.package.hmac]
|
||||
[profile.size.package.hmac]
|
||||
opt-level = 3
|
||||
|
||||
[profile.dev.package.backtrace]
|
||||
|
||||
@@ -10,8 +10,8 @@ A Cargo profile override optimizes a dependency's own code, but generic and `#[i
|
||||
code is compiled in the crate that instantiates it, at that crate's opt-level. Every
|
||||
function this crate exports is monomorphic and takes no caller-supplied type, so the
|
||||
cipher, curve, hash, KDF, HPKE and LZ4 code it reaches is instantiated here, where the
|
||||
workspace profiles keep it at `opt-level = 3` in every build mode. veilid-core can stay
|
||||
size-optimized for the WASM blob and still run its crypto at full speed.
|
||||
workspace profiles keep it at `opt-level = 3` in every build mode. The `size` profile the
|
||||
WASM builds use keeps veilid-core size-optimized and still runs its crypto at full speed.
|
||||
|
||||
Randomness comes in as a fill callback rather than an RNG type, so no `rand_core` version
|
||||
binds this crate to its callers.
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
//! code is compiled in the crate that instantiates it, at that crate's opt-level. Every
|
||||
//! function this crate exports is monomorphic and takes no caller-supplied type, so the
|
||||
//! cipher, curve, hash, KDF, HPKE and LZ4 code it reaches is instantiated here, where the
|
||||
//! workspace profiles keep it at `opt-level = 3` in every build mode. veilid-core can stay
|
||||
//! size-optimized for the WASM blob and still run its crypto at full speed.
|
||||
//! workspace profiles keep it at `opt-level = 3` in every build mode. The `size` profile the
|
||||
//! WASM builds use keeps veilid-core size-optimized and still runs its crypto at full speed.
|
||||
//!
|
||||
//! Randomness comes in as a fill callback rather than an RNG type, so no `rand_core` version
|
||||
//! binds this crate to its callers.
|
||||
|
||||
Generated
+2
-2
@@ -2553,9 +2553,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.23.43"
|
||||
version = "0.23.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0283386ce02abc0151e1761d08802dfe86c173b0b494af5cbc086574e453da06"
|
||||
checksum = "6725596c3f2c3a0aef021139e145d4eafe314a6623e4680ca83852b2c67ab2ba"
|
||||
dependencies = [
|
||||
"log",
|
||||
"once_cell",
|
||||
|
||||
@@ -20,10 +20,10 @@ fi
|
||||
|
||||
# Output filenames: veilid_flutter.js + veilid_flutter_bg.wasm.
|
||||
if [ "$RELEASE" -eq 1 ]; then
|
||||
OUTPUTDIR=$SCRIPTDIR/../target/wasm32-unknown-unknown/release/pkg
|
||||
INPUTDIR=$SCRIPTDIR/../target/wasm32-unknown-unknown/release
|
||||
OUTPUTDIR=$SCRIPTDIR/../target/wasm32-unknown-unknown/size/pkg
|
||||
INPUTDIR=$SCRIPTDIR/../target/wasm32-unknown-unknown/size
|
||||
|
||||
./wasm_remap_paths.sh cargo build --target wasm32-unknown-unknown --release --no-default-features --features=default-wasm -p veilid-flutter $@
|
||||
./wasm_remap_paths.sh cargo build --target wasm32-unknown-unknown --profile size --no-default-features --features=default-wasm -p veilid-flutter $@
|
||||
mkdir -p $OUTPUTDIR
|
||||
wasm-bindgen --out-dir $OUTPUTDIR --target web $INPUTDIR/veilid_flutter.wasm
|
||||
wasm-opt \
|
||||
|
||||
@@ -7,7 +7,7 @@ for SCHEMA in "Request" "RecvMessage"; do
|
||||
OUT="${SCRIPTDIR}/veilid/schema/${SCHEMA}.json"
|
||||
echo -n "Updating ${SCHEMA}..."
|
||||
if cargo run --quiet --manifest-path "${VEILIDDIR}/Cargo.toml" \
|
||||
-p veilid-remote-api --bin emit_schema -- "${SCHEMA}" > "${OUT}.tmp"; then
|
||||
-p veilid-remote-api --bin emit-schema -- "${SCHEMA}" > "${OUT}.tmp"; then
|
||||
mv "${OUT}.tmp" "${OUT}"
|
||||
echo " done."
|
||||
else
|
||||
|
||||
Generated
+2
-2
@@ -2525,9 +2525,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.23.43"
|
||||
version = "0.23.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0283386ce02abc0151e1761d08802dfe86c173b0b494af5cbc086574e453da06"
|
||||
checksum = "6725596c3f2c3a0aef021139e145d4eafe314a6623e4680ca83852b2c67ab2ba"
|
||||
dependencies = [
|
||||
"log",
|
||||
"once_cell",
|
||||
|
||||
File renamed without changes.
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# Usage:
|
||||
# ./wasm_build_js.sh # debug build (keeps DWARF info)
|
||||
# ./wasm_build_js.sh release # release build (wasm-opt -Oz)
|
||||
# ./wasm_build_js.sh release # size profile + wasm-opt -Oz
|
||||
# ./wasm_build_js.sh release --features=foo
|
||||
#
|
||||
# Extra args after the optional `release` token are forwarded to cargo build.
|
||||
@@ -28,8 +28,8 @@ WORKSPACE_TARGET="$SCRIPTDIR/../target/wasm32-unknown-unknown"
|
||||
|
||||
# --- cargo build -------------------------------------------------------------
|
||||
if [ "$RELEASE" -eq 1 ]; then
|
||||
cargo build --target wasm32-unknown-unknown --release "$@"
|
||||
WASM_IN="$WORKSPACE_TARGET/release/veilid_wasm.wasm"
|
||||
cargo build --target wasm32-unknown-unknown --profile size "$@"
|
||||
WASM_IN="$WORKSPACE_TARGET/size/veilid_wasm.wasm"
|
||||
else
|
||||
RUSTFLAGS="-g $RUSTFLAGS" cargo build --target wasm32-unknown-unknown --features debug-api "$@"
|
||||
WASM_IN="$WORKSPACE_TARGET/debug/veilid_wasm.wasm"
|
||||
|
||||
Reference in new issue
Block a user