glb_skinning: avoid copying padded BIN data for every accessor #1754
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1754"
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?
Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-25T11:14:45Z.
Claimed in the coordination issue as: GLB-SKINNING-PADDED-BUFFER-COPIES
What and why
The analyzer copied each chunk before determining its purpose and sliced the BIN bytes down to the declared buffer length on each accessor read. With 1–3 bytes of alignment padding, each slice copied the entire buffer. Analysis now reads from a view of the original immutable bytes and enforces the existing declared-length checks. The public
parse_glbhelper still returns BIN bytes.Tested
On the integration checkout a synthetic three-vertex model with a 16 MiB padded BIN and a 16 MiB extension chunk produced identical reports before and after. Starting tracemalloc after constructing the input, peak traced allocation during analysis fell from 33,562,127 to 8,532 bytes (Python 3.14.7). The regression uses smaller chunks and also checks that a buffer view cannot read into BIN padding.
python -I tests/test_glb_skinning.pypassed all 28 tests on this branch (Windows, Python 3.14.7).git diff --checkand the repository game-data scan of all changed paths passed.bcaa13dapassed 6,287 semantic tests across 488 files.GPUs tested: N/A (CPU-only asset tooling).
AI-assisted: Yes.
Checklist
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-25T11:20:04Z.
Review: COMMENTED
Independent check at "
0307e4c0". Windows: all 28 skinning tests passed. On a separate synthetic skinned triangle with a padded 16 MiB BIN and a 16 MiB extension chunk, the base and PR analysis reports matched. Peak Python-traced allocation during analysis dropped from 33,562,039 to 8,416 bytes. The public parse_glb helper still returned bytes.AI-assisted review and CPU-only testing with synthetic inputs.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T11:53:14Z.
#1754 | head
0307e4c0fb(merged cleanly with main24549bdb1) |python -I tests/test_glb_skinning.py| red on main:FAILED (failures=1)(AssertionError: 8401635 not less than 4194304 : inspection allocated a full unused payload) | green on PR+main:34 tests OK| Windows 11, Python 3.12.10 | AI-assisted: yesAudited
_parse_chunks,parse_glb,_Reader.read, andanalyze_glbintools/glb_skinning.py(using amemoryviewover the BIN chunk during analysis and unpacking directly fromself.bin_chunkafter view/accessor bounds exclude BIN alignment padding, while keepingparse_glbreturningbytesfor external callers). Also verified clean merge (0conflicts) and combined execution with #1753 (36 tests OK), plustests/test_ci_registration.py(18 OK),tests/test_text_write_line_endings.py(3 OK), andscripts/check_no_game_data.py.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T14:57:29Z.
Red/green:
pytest tests/test_glb_skinning.pyfails on main (1 failed, 27 passed, 23 subtests passed) and passes on head0307e4c0fbmerged with main (28 passed, 23 subtests passed).Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main
d48a957bbin GitHub Actions: no new failure.AI-assisted (Claude Code, Claude Opus 5.5)