Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Compute Unit Profile & 100x Priority Density

Compute Units (CU) represent the CPU execution budget allocated to a transaction on Solana (default ceiling: 200,000 CU per instruction). Efficient CU consumption directly determines transaction prioritization and priority fee economics.


On-Chain Measurement in Mollusk SVM

Using the official mollusk-svm test harness (Anza / Solana Labs):

#![allow(unused)]
fn main() {
#[test]
fn measure_exact_cu_consumption() {
    let program_id = Pubkey::new_from_array(PROGRAM_BYTES);
    let mut mollusk = Mollusk::new(&program_id, "u64se_seu_solana");

    let instruction = create_transition_instruction(S0_TO_S1);
    let result = mollusk.process_instruction(&instruction, &accounts);

    println!("Total CU Consumed: {}", result.compute_units_consumed);
}
}

Breakdown by Execution Phase

Execution PhaseTraditional AnchorPinocchio Baselineu64se-seu-solana
Instruction Deserialization1,800 - 3,500 CU150 - 300 CU~12 CU (Direct slice)
Account Ownership & Seeds3,200 - 8,000 CU600 - 1,200 CU~110 CU (Canonical bump)
ALU Invariant Logic1,200 - 4,500 CU120 - 400 CU~8 CU (Branchless mask)
Return Data / Event Log800 - 2,200 CU200 - 500 CU~45 CU (sol_set_return_data)
Total Isolated Instruction25,000 - 45,000 CU2,500 - 4,000 CU< 1,900 CU
Stateless Batch Hop (5 hops)150,000+ CU18,000 CU~341 CU / hop (2,011 CU)

The 100x Scheduler Leverage: Micro-Execution as Priority Weapon

Because a branchless u64se-seu-solana state transition executes in < 1,900 CU, transactions can request a tight budget:

#![allow(unused)]
fn main() {
ComputeBudgetInstruction::set_compute_unit_limit(2_000)
}

At flat 5,000 lamport base fees, this yields 100x higher validator reward density than conventional programs:

$$\text{Density}_{\text{u64se}} = \frac{5,000\text{ Lamports}}{2,000\text{ CU}} = 2.50\text{ L/CU}$$

$$\text{Density}_{\text{Anchor}} = \frac{5,000\text{ Lamports}}{200,000\text{ CU}} = 0.025\text{ L/CU}$$

To equal this priority score, an Anchor transaction must pay an extra 495,000 lamports (~0.0005 SOL) in priority tips.


Real Devnet Verification Record

On Solana Devnet, a live 5-hop transaction (S0 ──► S1 ──► S2 ──► S3 ──► S4 ──► S0) consumed: