BeginPlot: resolve the cached axis colours once per plot (X1) and copy them to the other five axes instead of resolving the auto colour chain per axis (bench implot scene, items stubbed: 0.457 -> 0.422 ms; draw data unchanged)

This commit is contained in:
4DBug committed 2026-10-21 02:26:50 -05:00
1 parent 5777ab0d5a
commit 0811513c9d
2 files changed
+22 -4

No files matched your search

+11 -2
View File
@@ -3611,9 +3611,18 @@ return function(G)
end
-- reset axes
-- [Luau] the cached colours do not depend on the axis: resolved once (X1) and copied to the other axes
-- (resolving the auto colours walks the auto colour chain and allocates: ~1.5 us per axis per frame)
local a0 = plot.Axes[0]
for i = 0, ImAxis.COUNT - 1 do
plot.Axes[i]:Reset()
UpdateAxisColors(plot.Axes[i])
local axis = plot.Axes[i]
axis:Reset()
if i == 0 then
UpdateAxisColors(axis)
else
axis.ColorMaj, axis.ColorMin, axis.ColorTick, axis.ColorTxt = a0.ColorMaj, a0.ColorMin, a0.ColorTick, a0.ColorTxt
axis.ColorBg, axis.ColorHov, axis.ColorAct = a0.ColorBg, a0.ColorHov, a0.ColorAct
end
end
-- ensure first axes enabled
plot.Axes[ImAxis.X1].Enabled = true
+11 -2
View File
@@ -3613,9 +3613,18 @@ end plot.Selected = true
end
-- reset axes
-- [Luau] the cached colours do not depend on the axis: resolved once (X1) and copied to the other axes
-- (resolving the auto colours walks the auto colour chain and allocates: ~1.5 us per axis per frame)
local a0 = plot.Axes[0]
for i = 0, ImAxis.COUNT - 1 do
plot.Axes[i]:Reset()
UpdateAxisColors(plot.Axes[i])
local axis = plot.Axes[i]
axis:Reset()
if i == 0 then
UpdateAxisColors(axis)
else
axis.ColorMaj, axis.ColorMin, axis.ColorTick, axis.ColorTxt = a0.ColorMaj, a0.ColorMin, a0.ColorTick, a0.ColorTxt
axis.ColorBg, axis.ColorHov, axis.ColorAct = a0.ColorBg, a0.ColorHov, a0.ColorAct
end
end
-- ensure first axes enabled
plot.Axes[ImAxis.X1].Enabled = true