mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:10:52 +01:00
[PR #58] replay_cpu_bench: stop overstating a draw 2.1x and a frame 1.9x (measure the layer, not the harness) #110
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#110
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/58
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/9780📝 Commits (1)
0e2e94dreplay_cpu_bench: a steady-state draw does not rebuild its views, so measure that apart📊 Changes
1 file changed (+36 additions, -1 deletions)
View changed files
📝
runtime/test/replay_cpu_bench.cpp(+36 -1)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):The layer's own CPU benchmark was overstating a draw by 2.1x and a frame by 1.9x, so anything optimized against it was optimized against the wrong number. This makes it measure the layer.
replay_cpu_bench'sdrawrows built a freshDrawViewswithmake_sharedinside the timed lambda — an allocation and a value-initialised block of 8 render-target views and 32 vertex-buffer views per draw. The layer does not do that:d3d12_com.cpp'sdraw_views()rebuilds the block only when the render targets or the vertex buffers change, and a steady-state draw copies theshared_ptr.What changes
The steady-state kinds share one block; a state change keeps its own rows (
draw, views rebuilt,draw indexed, views rebuilt), so the old case stays measured. The frame records the steady-state draw, which is what a frame does.Measured, same build, same machine
drawdraw indexedWith the views cost out of the way the profile reads differently:
prepare(138.6 ns) is the expensive part of a draw,recordis 30.4 ns. Before,recordlooked like the hot spot because the benchmark's ownmake_sharedsat in it.This is the tool used to conclude that the remaining substantial lever is the size of one prepared entry (
detail::Preparedis 1016 bytes,Command296,PreparedDraw312 — ~1.6 KB per draw per frame, measured in#8504with the per-command cost rising 99 → 253 ns as the set outgrows cache), and to reject two changes that sounded good and measured flat.replay_cpu_bench --self-test: 15 kinds and a 296-command frame, ok. Noruntime/srcchange; no GPU, no game data.cc
@ItsNotRexed@KoertLichtendonkChecklist
docs/design.md. (Not applicable: no translation change.)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.