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

@ -39,20 +39,16 @@ export function ui_nodes(ui_st: mut UiState, screen: string, view: UiView) -> Ui
return null
}
let t = ui_st.lib_screens[si]
pl_begin(ui_st, screen)
lc_begin(ui_st)
ui_st.ui_view = view
let e = env_new(null)
let e = env_new(ui_st, null)
if view != null and view.model != null { e.model = view.model() } else { e.model = Value.object() }
e.state = st_for(ui_st, screen, t, e)
let root = new UiNode
let root = nd_take(ui_st)
root.key = screen
root.children = new []UiNode
root.env = e
root.sheet = t.sheet
root.classes = new []string
root.akeys = new []string
root.avals = new []string
root.vals = new []Val
root.tag = "screen"
for i in 0 .. len(t.keys) {
if t.keys[i] != "name" { el_keep(root, t.keys[i], ui_eval(ui_st, t.vals[i], e)) }