Skip to content

Exp: Optimized CU, increase heap memory by Optimizing Bump Heap Allocation

Notifications You must be signed in to change notification settings

docongminh/optimized-heap-allocation

Repository files navigation

Exp: Optimizing bump heap allocation

Purpose: An experience for optimizing CU, increase the available heap memory for CPI calls between programs

For rust native

cd rust-native && cargo run release

For solana program

cargo test --manifest-path tests/Cargo.toml -- --nocapture

Result amount of CU optimized

Heap Allocation

Allocate 1024 bytes consumed 1500 compute units
Allocate 10240 bytes consumed 1800 compute units
Allocate 102400 bytes consumed 2200 compute units

Optimizing Bump Heap Allocation

Allocate 1024 bytes consumed 1200 compute units
Allocate 10240 bytes consumed 1600 compute units
Allocate 102400 bytes consumed 2000 compute units

Note: Sometime by miss-match version, build by command:

RUSTUP_TOOLCHAIN="nightly-2024-11-19" anchor build

About

Exp: Optimized CU, increase heap memory by Optimizing Bump Heap Allocation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages