https://github.com/defi0x1/optimized-heap-allocation
Exp: Optimized CU, increase heap memory by Optimizing Bump Heap Allocation
https://github.com/defi0x1/optimized-heap-allocation
cu-optimization heap-memory-allocator solana-program solana-program-test
Last synced: 3 days ago
JSON representation
Exp: Optimized CU, increase heap memory by Optimizing Bump Heap Allocation
- Host: GitHub
- URL: https://github.com/defi0x1/optimized-heap-allocation
- Owner: defi0x1
- Created: 2024-12-30T07:46:05.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-08-29T20:54:09.000Z (10 months ago)
- Last Synced: 2025-11-14T10:02:32.094Z (7 months ago)
- Topics: cu-optimization, heap-memory-allocator, solana-program, solana-program-test
- Language: Rust
- Homepage:
- Size: 273 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Exp: Optimizing bump heap allocation
**Purpose:** An experience for optimizing CU, increase the available heap memory for CPI calls between programs
For rust native
```bash
cd rust-native && cargo run release
```
For solana program
```bash
cargo test --manifest-path tests/Cargo.toml -- --nocapture
```
**Result amount of CU optimized**
*Heap Allocation*
```rust
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*
```rust
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:
```bash
RUSTUP_TOOLCHAIN="nightly-2024-11-19" anchor build
```