Skip to content

Reuse axis candidate storage and transfer prepared segment spans - #27

Merged
imakris merged 1 commit into
masterfrom
perf/hot-path-allocations-20261021
Oct 21, 2026
Merged

imakris merged 1 commit into
masterfrom
perf/hot-path-allocations-20261021

Conversation

@imakris

@imakris imakris commented Oct 21, 2026

Copy link
Copy Markdown
Member

Why

A horizontal-axis cache miss creates and destroys its tick-candidate vector for each density level. Preparing a built-in line or area also copies the newly computed segment-span vector into the draw-command handoff even though the preparation code can read the transferred storage.

Change

  • Keep the candidate vector alive for one axis calculation, clear it at each density level, and reuse its capacity. Reserve remains inside the existing step-preparation scope so early-rejected levels do not cause a new allocation.
  • Move computed segment spans into the caller's output vector, then use a const reference to that storage for the remainder of preparation. With no output vector, preparation continues to read the local storage. Existing early-return behavior and recorded span contents are preserved.

These are local ownership and allocation changes; tick selection, formatting, sample segmentation, and draw ordering remain the same. The likely benefits are axis-cache misses and discontinuous line/area frames. End-to-end gains have not been measured.

Validation

  • Baseline source bytes were verified against the pinned Git tree; both diffs pass whitespace checks.
  • Inspected the full preparation lifetime, including early success returns and the later draw-command move. Inspected existing LayoutCalculator and SampleUploadReuse test coverage.
  • Native tests were not run locally because CMake and Qt 6.12 are unavailable. Public QRhi and QRhi+Text PR workflows can provide build/test evidence; their results must be reviewed separately.

Before marking ready

Run LayoutCalculator and SampleUploadReuse in the supported QRhi configurations, and measure an axis-cache-miss/segmented-series workload against the baseline. This PR is a draft pending native and performance evidence.

Independent review

Fresh-context independent source review found no remaining code blocker in this exact candidate. Native tests and representative application performance evidence remain pending as described above.

@imakris
imakris marked this pull request as ready for review October 21, 2026 09:22
@imakris
imakris merged commit d25221e into master Oct 21, 2026
12 checks passed
@imakris
imakris deleted the perf/hot-path-allocations-20261021 branch October 21, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant