ludic.ui: a screen's nodes and envs are pooled and used again - two generations a screen, reset in place, their own lists emptied not replaced; a tree is good until its screen is built twice more (benchmark 256 -> 110 KB a frame)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-27 23:33:48 +03:00
parent 83200a453b
commit d1c9359e96
19 changed files with 307 additions and 83 deletions

View file

@ -1,16 +1,16 @@
# controls_parts.ludic - what a control shows besides its own parts: its label, with a `note` (a line
# of help under it) in .ui-labels > .ui-label + .ui-note, and a range's or a number's value as text:
# `decimals="1"` places, `format="percent"` its place between min and max, and a `unit` after it
function ct_label(ui_st: UiState, n: UiNode) -> void {
function ct_label(ui_st: mut UiState, n: UiNode) -> void {
let label = ui_attr_text(n, "label")
let note = ui_attr_text(n, "note")
if note == "" {
if label != "" { push(n.children, ct_part(n, "ui-label", ui_tr(ui_st, label))) }
if label != "" { push(n.children, ct_part(ui_st, n, "ui-label", ui_tr(ui_st, label))) }
return
}
let both = ct_part(n, "ui-labels", "")
if label != "" { push(both.children, ct_part(n, "ui-label", ui_tr(ui_st, label))) }
push(both.children, ct_part(n, "ui-note", ui_tr(ui_st, note)))
let both = ct_part(ui_st, n, "ui-labels", "")
if label != "" { push(both.children, ct_part(ui_st, n, "ui-label", ui_tr(ui_st, label))) }
push(both.children, ct_part(ui_st, n, "ui-note", ui_tr(ui_st, note)))
push(n.children, both)
}
function ct_value_text(n: UiNode) -> string {