Cocos AIR performance contracts
Stop once you can answer the task. Do not read another same-topic reference for the same question.
Scope: Batching, instancing, dynamic atlases, measured draws and pause/step frame budgets.
Environment: use package imports in apps; source paths require an AIR checkout. See context.
Quick Start
For complete setup and teardown, read Quick Start.
Siblings: direct dependencies; reuse loaded skills.
Triggers
- Reduce draws for many identical objects
- Batch static subtrees or update dynamic geometry
- Diagnose incompatible mesh merges
- Measure actual draws with profiler counters
- Pack UI textures or explain broken batches
- Pause rendering with one controlled step clock
- Limit pixel ratio on slow devices
- Check the limits of recorded performance evidence
Exact API and symptom mappings: triggers.
Contracts
Choose static merge, dynamic atlas or instancing according to the scene and material. Measure actual draw counts. For on-demand rendering, wait for the first draw before pausing and keep one step clock.
Read references/contracts.md only when the task needs exact option rules, limits, error behavior or source annotations. Prefer the topic references below for a narrower question.
Common Mistakes
- [HIGH] UIStaticBatch is inert; choose a supported batching route.
- [HIGH] Static batching does not preserve per-node materials.
- [HIGH] Use game.pause for the main loop and profiler.showStats.
- [MEDIUM] Turning atlas on mid-scene does not guarantee fewer draws.
Read relevant wrong/right examples before implementation.
Reference map
- Which batching route? - Routes and counts
- Can sprites pack? - Acceptance and leases
- Will instancing help? - Macro and grouping
- Instances without per-object Nodes? - Explicit buffers and ownership
- GPU points, voxels or polished shapes? - Sampling, transitions and surface controls
- What does profiling prove? - Counters and step clock