Build: cleanups after #728 (one free-memory reader, one function-start pattern, no behaviour change) #735
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!735
Loading…
Reference in a new issue
No description provided.
Delete branch "build-speed-cleanup"
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?
Follow-up to #728: tidy-ups, no behaviour change.
This also fixes the Windows test failures #728 introduced on main ("Python source checks (windows-2022)":
test_chunk_split,test_mem_gate). On Windows,Path.write_textwrites\r\n, so the fixtures differed from the lifted C, which is always written with\n:{.The second commit makes the fixtures write
\n, and lets a note line above a function end in\r\n. I checked both by simulating CRLF writes locally.This branch also merges main. Main's own fix for the same two tests is kept, except that
test_chunk_splitreads its parts withoutread_text(newline=), which Python 3.12 (CI's version) doesn't have.With main's repaired workflow (#760) merged in, CI passes on Ubuntu and Windows.
make_game.default_jobsread the free memory only to print it, now that the memory gate decides. That read and its second copy of the WindowsMEMORYSTATUSEXstructure are gone, andbuild.free_mbis the one reader.up to 24 compilers at once (one per CPU thread), as the memory allows.nx2/lifted_c.py. It replaces three copies:build.mem_need, through a bytes version of the pattern;chunks.HEAD, which keeps the optional/* ... */line above a function;split_hot.HEAD, which captures the name.build.pydoesn't have to import the lifter.COMPILER_MB: the 1.5 GB counted for one compiler is now one constant, used for a hot piece's need and for the countdown's estimate (MemoryGate.expected).threadingand the Windowsctypesstructures are now at module level inbuild.py.chunks.writeusesnonlocalinstead of a one-item dict.write_lift_keyuses"\n".lift_keyno longer inserts intosys.pathon every call:make_gamealready sets it once at import.split_hot.pydocstring is wrapped to the file's width, and the measured machine is called "a 24-thread desktop" in comments.No behaviour change. I checked this against the C from a real lift (81 files, including
code_hot.c.whole):mem_need, the function starts thatchunksandsplit_hotfind, andchunks.text_costgive the same results as before. Only the lift key changes, becausenx2/changed, so the first build after this lifts once more.Tests
python -I -B tests/run_all.py --strict: 87 passed, 1 failed, 4 skipped. Plain main gives the same result here. The one failure istest_make_game_cache.py, which fails on this machine with or without this change.test_build_times,test_linux_builder_jobs(updated:default_jobsno longer reads the memory),test_mem_gate,test_chunk_split,test_parallel_emitandtest_lift_cachepass.@@plan/@@eta, longest file first.