7.5 Compute Optimization
Target Compute Units:
Market creation: <100,000 CU
Buy/sell outcome: <200,000 CU
Claim fees: <50,000 CU
Platform registration: <80,000 CU
Optimization Techniques:
Lazy Loading: Load only required accounts
Zero-Copy Deserialization: For large account data
Lookup Tables: Pre-compute common values
Early Termination: Exit loops when precision sufficient
Batch Operations: Combine multiple ops when possible
Example: Zero-Copy for Large Markets
#[account(zero_copy)]
pub struct LargeMarket {
pub data: [u8; 10000],
}
// Access without full deserialization
let market = load::<LargeMarket>(&account_info)?;Last updated

