An open API service indexing awesome lists of open source software.

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

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
```