public sealed class HotPathAttributeDeclares that a member runs inside the frame loop and must not allocate. It is a contract for VXHP0001 and for whoever edits the method next, not a hint to the JIT.
No guide page documents this yet — the page shows what the code says about itself.
As a annotation
- Valid on
- Class, Struct, Constructor, Method, Property
Remarks
⚠ The summary above named an "allocation analyzer" for a year and there was none (#1161), which made this attribute read from a call site exactly like a checked contract and behave like a comment. Core/Vixen.Core.Analyzers is the analyzer now; the rule is VXHP0001 and every Core/ project runs it, which TreatWarningsAsErrors makes a build failure.
What it checks is the marked body and nothing deeper. A new, an array, a boxed value, a capturing lambda or a built string written here is reported; an allocation inside a method this one calls is not, and cannot be. The instrument for that half already exists and is stronger — Vixen.Testing.Measured counts allocated bytes across real work and asserts exactly zero — so the two are complements rather than substitutes: the counter sees through a call on the paths a test drives, and the rule sees the edit on every build, including on the members no test measures.
⚠ It says nothing about logging. Doc 13's "no logging in the innermost loops" is a convention, and a claim that this attribute enforced it was false in two files (#344).
Used by (6)
- AnalyzerHarnessVixen.Core.Analyzers.Tests
- ChunkVixen.Ecs
- EffectSchedulerVixen.Ui.Reactive
- EnumeratorVixen.Ecs
- HotPathAllocationAnalyzerTestsVixen.Core.Analyzers.Tests
- WorldVixen.Ecs