diff options
| author | traeb0n <masonbartelme@gmail.com> | 2026-11-21 22:26:54 -0600 |
|---|---|---|
| committer | traeb0n <masonbartelme@gmail.com> | 2026-11-22 09:19:29 -0600 |
| commit | 9d47be3dec7096d69870bf6416b96e182cf0c1bb (patch) | |
| tree | dbe2a2e3d676705945610445fd5d1a6d14b9f701 /runtime/src/pe_loader.cpp | |
| parent | 9df4eda200b6cd7b8b33dd6f8bc84d681d2c7a29 (diff) | |
Runtime: no heap allocation per barrier, clear or copy in replay
Three allocations replay_cpu_bench (#878) found on the hot path:
- detail::current returned a std::vector<LayoutPiece> for every
transition, clear and copy in emit, though the answer is nearly always
one piece (two with separate depth/stencil). LayoutPieces keeps two
inline and spills to the heap beyond that, with the same interface
(begin/end, size, push_back, clear), so `auto pieces = current(...)`
callers compile as is. LayoutTracker::pieces takes either container.
- detail::clip built a new vector with push_back (two allocations for two
rectangles); it now writes into the kept entry's p.rects.
- CommandList::append took const Command& and copied the temporary the
recording calls build, so a rectangle clear's vector was allocated
twice; an rvalue overload moves it.
replay_cpu_bench, i7-14700K, on top of #893: the frame goes from 194 to
173 ns per command, emit from 48 to 33 ns; emit makes no allocation per
command in the frame (0.43 before) and prepare 0.07 (0.26), and
recording makes one only for a rectangle clear's own rectangles.
d3d12_state_map_test checks LayoutPieces against the vector path,
including the spill at four pieces.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/pe_loader.cpp')
0 files changed, 0 insertions, 0 deletions