Performance and reporting improvements

This commit is contained in:
Michael Freno
2025-11-17 17:41:01 -05:00
parent a8be1f5342
commit 2c04f69daa
18 changed files with 1987 additions and 82 deletions

View File

@@ -305,8 +305,20 @@ end
--- Main draw method - renders all visual layers
---@param backdropCanvas table|nil Backdrop canvas for backdrop blur
function Renderer:draw(backdropCanvas)
-- Start performance timing
local Performance = package.loaded["modules.Performance"] or package.loaded["libs.modules.Performance"]
local elementId
if Performance and Performance.isEnabled() and self._element then
elementId = self._element.id or "unnamed"
Performance.startTimer("render_" .. elementId)
Performance.incrementCounter("draw_calls", 1)
end
-- Early exit if element is invisible (optimization)
if self.opacity <= 0 then
if Performance and Performance.isEnabled() and elementId then
Performance.stopTimer("render_" .. elementId)
end
return
end
@@ -354,6 +366,11 @@ function Renderer:draw(backdropCanvas)
-- LAYER 3: Draw borders on top of theme
self:_drawBorders(element.x, element.y, borderBoxWidth, borderBoxHeight)
-- Stop performance timing
if Performance and Performance.isEnabled() and elementId then
Performance.stopTimer("render_" .. elementId)
end
end
--- Get font for element (resolves from theme or fontFamily)