Skip to content

Create a performance patterns section in the Anchor documentation #4284

@nutafrost

Description

@nutafrost

Introduce a dedicated performance section documenting escape hatches and optimization patterns available to developers who need to go beyond the default Anchor abstractions.

Content to include:

  • Custom entrypoint with discriminator-based dispatch (as shown in the design doc) that falls back to the Anchor entry function.
  • When and how to use raw AccountView access instead of typed Account<T> for hot paths.
  • Zero-copy layout best practices: alignment, padding, repr(C) rules.
  • Benchmarking methodology (CU usage, LiteSVM-based benchmarks).
  • Trade-offs: what safety guarantees you give up with each escape hatch.

Acceptance criteria:

The Anchor documentation has a "Performance" section with runnable code examples and CU comparisons.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions