Skip to content

Component profiling#95

Open
kunitoki wants to merge 10 commits into
mainfrom
dev/component_paint_profiling
Open

Component profiling#95
kunitoki wants to merge 10 commits into
mainfrom
dev/component_paint_profiling

Conversation

@kunitoki
Copy link
Copy Markdown
Owner

@kunitoki kunitoki commented May 20, 2026

image

This pull request introduces a built-in component paint profiling system to the YUP UI framework, allowing developers to measure and analyze the rendering performance of individual components. It adds comprehensive API support, a detailed user guide, and integrates profiling into the example app. Additionally, it improves keyboard focus handling by making it more configurable and robust.

The most important changes are:

Component Paint Profiling System:

  • Introduced a new paint profiling API in the Component class, including methods to enable/disable profiling, access and reset statistics, and retrieve profiling names. Added all necessary infrastructure for collecting, storing, and summarizing per-component paint timings, guarded by the YUP_ENABLE_COMPONENT_PAINT_PROFILING flag. [1] [2]
  • Instrumented the component painting pipeline to record timings for self, children, and framework overhead, and to track skipped paints and continuous rendering. Profiling is integrated with minimal overhead and is fully disabled in builds without the flag. [1] [2]
  • Added a detailed guide, docs/Profiling Component Paint.md, explaining how to enable, use, and interpret the new profiling system.
  • Enabled paint profiling by default in the graphics example app by setting YUP_ENABLE_COMPONENT_PAINT_PROFILING=1 in its CMake configuration.
  • Added a new PaintProfilerDemo to the example app to showcase the profiling system in action. [1] [2]

Keyboard Focus Handling Improvements:

  • Added new methods to Component for configuring and querying keyboard focus behavior (setWantsKeyboardFocus, getWantsKeyboardFocus, setClickingGrabFocus, getClickingGrabFocus). Clicking now walks up the parent chain to find a focusable component, and this logic is encapsulated in handleKeyboardFocusFromClick. [1] [2] [3] [4] [5]
  • Changed mouse down handling to invoke the improved focus logic, ensuring correct focus assignment on click.

These changes collectively provide powerful new tools for diagnosing UI performance issues and improve the flexibility of keyboard focus management.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

❌ Patch coverage is 83.87097% with 70 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.76%. Comparing base (94b274c) to head (d4e33ff).

Files with missing lines Patch % Lines
modules/yup_gui/profiling/yup_PaintProfiler.cpp 91.78% 18 Missing ⚠️
modules/yup_gui/native/yup_Windowing_sdl2.cpp 0.00% 17 Missing ⚠️
modules/yup_gui/component/yup_Component.cpp 78.94% 16 Missing ⚠️
...odules/yup_gui/profiling/yup_PaintProfileStats.cpp 91.50% 9 Missing ⚠️
modules/yup_gui/component/yup_ComponentListener.h 20.00% 8 Missing ⚠️
modules/yup_gui/profiling/yup_PaintProfiler.h 33.33% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #95      +/-   ##
==========================================
+ Coverage   73.58%   73.76%   +0.17%     
==========================================
  Files         577      581       +4     
  Lines       56826    57237     +411     
==========================================
+ Hits        41818    42221     +403     
- Misses      15008    15016       +8     
Files with missing lines Coverage Δ
modules/yup_gui/component/yup_Component.h 76.00% <ø> (ø)
...odules/yup_python/bindings/yup_YupGui_bindings.cpp 95.11% <100.00%> (+0.06%) ⬆️
modules/yup_gui/profiling/yup_PaintProfiler.h 33.33% <33.33%> (ø)
modules/yup_gui/component/yup_ComponentListener.h 20.00% <20.00%> (ø)
...odules/yup_gui/profiling/yup_PaintProfileStats.cpp 91.50% <91.50%> (ø)
modules/yup_gui/component/yup_Component.cpp 65.21% <78.94%> (+6.87%) ⬆️
modules/yup_gui/native/yup_Windowing_sdl2.cpp 8.39% <0.00%> (-0.12%) ⬇️
modules/yup_gui/profiling/yup_PaintProfiler.cpp 91.78% <91.78%> (ø)

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 94b274c...d4e33ff. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kunitoki kunitoki force-pushed the dev/component_paint_profiling branch from cf65886 to c055690 Compare May 20, 2026 13:12
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