OLD-9481: restore old upstream PR 9481 - world_build: drop a staged chunk PNG once no later chunk uses it #735
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!735
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/735/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@aslan2142 on GitHub · 2026-11-24 13:09 UTC · original
aslan2142:world-build-png-budget→main· +195 −26 · 2 files · 1 commits · merged 2026-11-25 22:28 UTCClaimed in the coordination issue as: OLD-9481 #14
Restoration of my original pull request, old upstream PR 9481 in
ItsNotRexed/Leonida, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at9600cf0c64; the commit applies unchanged, sincetools/world_build.pyandtests/test_world_build.pyhave not changed on main since the original base.What and why
_build_staged_worldintools/world_build.py(the spatial, grid and baked-placement builds) keeps every decoded chunk PNG in its single-flight cache until the build returns. The PNGs held grow with the chunk count._SharedPng(an event plus the bytes);world.jsonare byte-identical.StagedPngRetentionTestintests/test_world_build.py, on synthetic chunks with uniform 4x4 DDS textures:Tested
Linux, Python 3.14.10, CPU only, synthetic inputs (no game files):
python -I tests/test_world_build.py:A synthetic 24-chunk build on main and on this branch:
Decoded PNGs held while each chunk is written (main → this branch):
The 4-worker counts depend on thread timing.
python -m compileall -q tools tests,git diff --check, andpython -I scripts/check_no_game_data.pyon both changed files: all clean.On the old repository, the original pull request had five independent checks: Linux, a four-worker concurrency run, and Windows on Python 3.11 and 3.13.
GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)AI-assisted (Claude Code, Claude Opus 5.5).
@abnalstlll-byte on GitHub · 2026-11-24 13:14 UTC · original · approved these changes
LGTM. Reference-counted memory bounded PNG staging cache in world_build.py significantly reduces peak RAM footprint during multi-chunk builds. Verified clean-room synthetic unit test coverage in ests/test_world_build.py.
@abnalstlll-byte on GitHub · 2026-11-24 13:26 UTC · original · approved these changes
Audited and verified. Clean-room compliant.
@aslan2142 on GitHub · 2026-11-25 22:28 UTC · original
Merged:
world_builddrops a staged chunk PNG once no later chunk uses it.main, and no review point is open.tests/test_world_build.pypasses onmain+ this head (Linux, CPython 3.14).mainb73968599+198b5c5bc: the semantic suite passes (492 files, 6,315 tests, 0 files failed);test_world_buildpass; the 15 docs and writer tests pass;check_no_game_data.pyis clean on the 2 changed files.AI-assisted (Claude Code, Claude Opus 5.5).