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

@ -0,0 +1,61 @@
# pool_reset.ludic - a pooled node put back to its defaults: every field, and the lists it owns
# emptied and kept (generated from node.ludic - a field added there is added here)
function nd_reset(n: UiNode) -> void {
nd_reset_a(n)
nd_reset_b(n)
}
function nd_reset_a(n: UiNode) -> void {
n.kind = 0
n.dir = 0
n.text = ""
n.key = ""
n.tag = ""
n.id = ""
if n.classes != null { List.clear(n.classes) }
if n.akeys != null { List.clear(n.akeys) }
if n.avals != null { List.clear(n.avals) }
if n.vals != null { List.clear(n.vals) }
n.style = null
n.sheet = null
if n.ups != null { List.clear(n.ups) }
n.parent = null
n.index = 0
n.src = ""
n.size = 0.0
n.w = -1000000.0
n.h = -1000000.0
n.w_pct = 0.0
n.h_pct = 0.0
n.pt = 0.0
n.pr = 0.0
n.pb = 0.0
n.pl = 0.0
n.mt = 0.0
n.mr = 0.0
n.mb = 0.0
n.ml = 0.0
n.border = 0.0
n.bt = 0.0
n.br = 0.0
n.bb = 0.0
n.bl = 0.0
n.border_c = -2
n.gap = 0.0
n.align = 0
n.justify = 0
n.talign = 0
n.self = -1
n.grow = 0.0
n.wrap = false
n.min_w = 0.0
n.max_w = 0.0
n.min_h = 0.0
n.max_h = 0.0
n.hidden = false
n.pos = 0
n.top = -1000000.0
n.right = -1000000.0
n.bottom = -1000000.0
n.left = -1000000.0
n.z = 0
}