runtime, ludic.ui: a scalar Value is one allocation, not three (lists only for a list or an object); layout and cascade lists kept a depth; small numbers' text made once - benchmark 63 -> 36 KB a frame

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-27 23:43:25 +03:00
parent 1d40f6d95a
commit 46888b6716
14 changed files with 84 additions and 33 deletions

View file

@ -71,3 +71,14 @@ function vl_binary(op: string, a: Val, b: Val) -> Val {
# a value as text, whatever kind it is: a component's string prop given a number (label="{3}") reads
# "3", not nothing
export function ui_val_text(v: Val) -> string { return vl_text(v) }
# vl_text for what is asked per element per frame: a small whole number's text comes from the table
# made once (mm_int) rather than being written out again
function vl_text_u(ui_st: mut UiState, v: Val) -> string {
let k = Value.kind(v)
if k == 1 { return mm_int(ui_st, Value.as_int(v)) }
if k == 2 or k == 7 {
let f = Value.as_float(v)
if f == float(int(f)) { return mm_int(ui_st, int(f)) }
}
return vl_text(v)
}