ludic.ui: a node is made with its UiNodeX, so nx() makes none in a frame; a screen's pool grows both generations together and by half again at once, so a screen's first frames and its reopenings make nothing past the first growth
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0ed66baed0
commit
afc2d019a3
1 changed files with 13 additions and 3 deletions
|
|
@ -60,10 +60,19 @@ function nd_take(ui_st: mut UiState) -> UiNode {
|
||||||
nd_reset(n)
|
nd_reset(n)
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
let n = nd_fresh()
|
pl_grow_nodes(p)
|
||||||
ui_kept(list, n)
|
|
||||||
p.un += 1
|
p.un += 1
|
||||||
return n
|
return list[p.un - 1]
|
||||||
|
}
|
||||||
|
# past a screen's most nodes: both generations grow together and by a stretch at once, so the
|
||||||
|
# frame after (the other generation) and the next few elements find theirs already made
|
||||||
|
@alloc_ok("a pool miss: past the most nodes a screen has had, then kept")
|
||||||
|
function pl_grow_nodes(p: UiPool) -> void {
|
||||||
|
let more = Math.max(16, len(p.nodes0) / 2)
|
||||||
|
for i in 0 .. more {
|
||||||
|
push(p.nodes0, nd_fresh())
|
||||||
|
push(p.nodes1, nd_fresh())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@alloc_ok("a pool miss: past the most nodes a screen has had, then kept")
|
@alloc_ok("a pool miss: past the most nodes a screen has had, then kept")
|
||||||
function nd_fresh() -> UiNode {
|
function nd_fresh() -> UiNode {
|
||||||
|
|
@ -73,6 +82,7 @@ function nd_fresh() -> UiNode {
|
||||||
n.akeys = new []string
|
n.akeys = new []string
|
||||||
n.avals = new []string
|
n.avals = new []string
|
||||||
n.vals = new []Val
|
n.vals = new []Val
|
||||||
|
n.ex = new UiNodeX # made with the node: nx() then never makes one in a frame
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
function env_take(ui_st: mut UiState) -> UiEnv {
|
function env_take(ui_st: mut UiState) -> UiEnv {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue