Documentation
¶
Overview ¶
Package bench holds shared painter scenarios that drive both Cairo and glui paint.Painter implementations. The benchmarks parameterise the painter so the same workload runs against both backends; the per-backend bench files (glui_bench_test.go, cairo_bench_test.go) supply the painter and call into here.
Each scenario is a func that takes a paint.Painter plus the iteration budget and exercises a typical UI workload — repeated rect fills, a scrolling list, a small form. Scenarios deliberately avoid leaking backend-specific paths (e.g. Renderer.End or pixmap.Flush): the per-backend bench wrapper handles that.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LinearGradient ¶
LinearGradient paints n axis-aligned rects each filled with a two- stop linear gradient. Gradients land on the linear-gradient fast path in glui (uniform-based) so this measures the gradient brush transition cost.
func RectFill ¶
RectFill paints n axis-aligned rects in a grid, with alternating brush colours. This is the dominant UI primitive — every panel, button bg, list row, divider goes through this path.
func RoundedRect ¶
RoundedRect paints n rounded rects via four arcs + line segments. Rounded rects are common chrome (cards, badges, modal headers); they stress the curve-emission path on both backends.
func ScrollingList ¶
ScrollingList simulates a single scroll frame of a 1000-row list: alternating background, divider, label per row. This is closer to a real frame than the single-primitive scenarios.
func TextPaint ¶
TextPaint draws n short labels at varying positions. This benches the text path (font lookup, glyph advance, rect emission) — the second- dominant cost in real UIs.
func TypicalForm ¶
TypicalForm draws a small dialog: 1 background, 1 title, 5 rows of (label + edit), 2 buttons. Per-frame cost of a typical settings dialog is dominated by this kind of mix.
func WidgetRows ¶
WidgetRows draws rows the way real widgets actually do: each row sets its own fill color via SetBrush1, fills its background, sets a border pen via SetPen1, strokes a divider, then sets a text color and draws a label. Unlike ScrollingList — which reuses a handful of pre-built *SolidBrush values — this exercises the SetBrush1/SetPen1/DrawText setters every widget invokes per frame, so it reflects real per-frame allocation behaviour (the path the painter's reused brush/pen/glyph buffers target).
Types ¶
This section is empty.