perf(json): 23.2 - a parsed tree can be let go (Value.free / Json.free: its nodes and lists, not its strings), a string is parsed in one allocation instead of one per character, the parser's cursor is freed, and gltf_load frees the last file's tree and the text it parsed

300 parses of a 446 KB glTF: 2118 MB before, 528 MB with the one-allocation string, 94 MB freed.
A headless Maroon Lake at play: 2334 -> 2195 MB by footprint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-27 22:17:27 +03:00
parent 537d3a0ab3
commit 9539f7bcec
3 changed files with 42 additions and 2 deletions

View file

@ -478,10 +478,12 @@ namespace Value {
alias as_int(value) = value_as_int
alias as_float(value) = value_as_float
alias as_str(value) = value_as_str
alias free(value) = value_free
}
namespace Json {
alias encode(value) = json_encode
alias parse(text) = json_parse
alias free(value) = json_free
}
namespace Xml {
alias parse(text) = xml_parse