Execution and Storage Cost
- Step budgets. Functions cost steps: measured by the runner, budgeted like gas.
- Builtin usage. Hashes and range checks spend builtins: counted and optimised where hot.
- Storage economics. Storage writes carry L1 data costs: lean state is the fee lever.
Efficient Contract Patterns
- Batch and pack. Batching amortises overhead; packed storage trims data costs: measured trade-offs.
- Off-chain with proofs. Heavy computation moves off-chain under proofs: the chain verifies, never re-computes.
- Event-based history. History lives in events: indexers reconstructing state cheaply off-chain.
Production Optimisation
- Profile the runner. Optimisation starts from runner reports: steps per entry point, tracked per commit.
- Readability guard again. An optimisation obscuring an invariant is a loss: audits cost more than steps.
- Benchmark per upgrade. Compiler and network upgrades shift costs: re-measure per release, assume nothing.
Before and after this level
- Before: Level 12: Proof-Oriented Execution: Sierra and CASM Concepts, Provable Computation, Understanding Cairo's Unique Runtime.
- Next: Level 14: Cairo Mastery: Advanced Starknet Architecture, Security and Proof Trade-Offs, Reading and Improving Complex Cairo.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does Cairo Level 13: Performance cover?
Execution and Storage Cost, Efficient Contract Patterns, Production Optimisation: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 12: Proof-Oriented Execution, which covers Sierra and CASM Concepts, Provable Computation, Understanding Cairo's Unique Runtime.