Skip to content

Commit 67397ca

Browse files
build: optimize dev builds (snarkvm-style profiles), build-both.sh arg pass-through
Without profile overrides maturin develop produced a genuinely unoptimized extension — proving benchmarked 6-10x slower than native snarkvm. Mirror snarkvm's own profiles (dev opt-level 3) in both crates so local builds are usable for perf work, and let build-both.sh forward flags (./build-both.sh --release).
1 parent 9cd39ce commit 67397ca

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

sdk-abi/Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,13 @@ leo-span = { git = "https://github.com/ProvableHQ/leo", rev = "ba2c01722a48f84b4
2525
# Same tag + feature set leo pins, so `Process<N>`/`Program<N>` are the same
2626
# types leo-disassembler's signatures expect.
2727
snarkvm = { git = "https://github.com/ProvableHQ/snarkVM", tag = "v4.8.1", features = ["test_consensus_heights", "dev_skip_checks", "test_targets", "history"] }
28+
29+
[profile.release]
30+
opt-level = 3
31+
lto = "thin"
32+
incremental = true
33+
34+
[profile.dev]
35+
opt-level = 3
36+
lto = "off"
37+
incremental = true

sdk/Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,16 @@ sha2 = "0.10"
3232
snarkvm = { git = "https://github.com/ProvableHQ/snarkVM.git", tag = "v4.8.1", default-features = false, features = [
3333
"console", "circuit", "synthesizer", "ledger", "utilities", "algorithms", "parameters",
3434
] }
35+
36+
# Mirror snarkvm's profiles: crypto is unusable unoptimized, so dev builds
37+
# get opt-level 3 too (profiles apply from the root crate only — snarkvm's
38+
# own settings are ignored when it builds as a dependency).
39+
[profile.release]
40+
opt-level = 3
41+
lto = "thin"
42+
incremental = true
43+
44+
[profile.dev]
45+
opt-level = 3
46+
lto = "off"
47+
incremental = true

sdk/build-both.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if ! command -v maturin >/dev/null 2>&1; then
3131
fi
3232

3333
echo "==> [1/2] mainnet: maturin develop --features mainnet"
34-
maturin develop --features mainnet
34+
maturin develop --features mainnet "$@"
3535

3636
echo "==> [2/2] testnet: build wheel with module-name override, extract .so"
3737
WORK="$(mktemp -d)"
@@ -58,7 +58,7 @@ s = s.replace('module-name = "aleo._aleolib_mainnet"',
5858
open(p, "w").write(s)
5959
PY
6060

61-
maturin build --no-default-features --features testnet --out "$WORK/dist"
61+
maturin build --no-default-features --features testnet --out "$WORK/dist" "$@"
6262

6363
restore_pyproject
6464

0 commit comments

Comments
 (0)