Skip to content

Avoid per-label allocations and redundant stable sorting - #28

Merged
imakris merged 1 commit into
masterfrom
perf/label-storage-and-draw-sort-20261022
Oct 22, 2026
Merged

imakris merged 1 commit into
masterfrom
perf/label-storage-and-draw-sort-20261022

Conversation

@imakris

@imakris imakris commented Oct 22, 2026

Copy link
Copy Markdown
Member

Why

Each label fade update allocates a separate temporary vector for the previous and current text of every emitted label. Those vectors never contain more than two entries. The final prepared draw list also uses stable_sort even though its comparator ends with a unique insertion_order key.

Changes

  • Store each label's two temporary text records inline, retaining the existing emission and duplicate-suppression behavior and C++17 compatibility.
  • Use std::sort for the final prepared draw list. Preserve the earlier stable_sort that controls layer preparation order.

Validation

  • Built test_core_algo and test_qrhi_layer_lifecycle in Release with the supplied Qt 6.12/GCC 13 SDK, text support and MSDF RHI enabled.
  • CoreAlgo passed all 32 checks; QrhiLayerLifecycle passed all 40 checks, including layer preparation and final draw ordering.
  • Compiled a production-header instantiation separately with -std=c++17 -pedantic-errors. The full-text build itself uses C++20 through its dependency requirements.
  • git diff --check passed.

The earlier isolated allocation experiment motivated this change. End-to-end Logonomic profiling and visual validation on the deployment platforms remain outstanding; this PR does not claim an application-wide speedup.

Store the bounded previous/current label text pair inline. Use std::sort for the final prepared draw list, whose comparator ends in unique insertion order, while preserving stable layer preparation order.
@imakris
imakris marked this pull request as ready for review October 22, 2026 04:46
@imakris
imakris merged commit 5feaf01 into master Oct 22, 2026
12 checks passed
@imakris
imakris deleted the perf/label-storage-and-draw-sort-20261022 branch October 22, 2026 04:47
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