WIP: fix(build): the hash record is written under its build's start, and keeps only the keys used #35
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
needs measurements
question
testing wanted
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!35
Loading…
Reference in a new issue
No description provided.
Delete branch "dyst/Longshot:fix/hash-cache-clock"
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?
Why
The build's hash record was written under the time it was saved, seconds after the sources were stat'd, which loosens the 2 s rule on coarse-timestamp filesystems; and the record only grew, by one key per renderer source for every header edit (hckrman101's two non-blocking points on NotRexed/Hookshot#2702).
What changed
load_hashesinnx2/build.pytakes the time before any source is stat'd (HASHES_STARTED), andsave_hasheswrites that aswritten_ns, not the time of the save after the whole plan.key_ofandcontent_sha1note, per source, the keys this build asked for (USED).save_hashes(itskepthelper) keeps only those keys for each source this build looked at; a source it didn't look at, such as a renderer-only build's lifted C, keeps its record as it was.HASH_SCHEMEstays 1), so no object is renamed and nothing compiles again for this change.tests/test_build_hash_cache.py,test_the_record_is_written_under_the_time_its_build_startedandtest_a_source_this_build_looked_at_keeps_only_the_keys_it_asked_for. Both fail onmain.Flags and settings
None
Measurements
Measured on the GitHub version (NotRexed/Hookshot#2873), not yet on Longshot: this PR stays WIP until it is.
Hardware: Ryzen 9 3900X, Windows 11
Scene: none (a build measurement): a work folder of 874 sources
Method: four builds in a row: a comment added to
gpu/vk/vk_present_rect.h, a second comment, both taken out again, then a build with nothing changed. The numbers are the hash record's total keys after each build.mainwith NotRexed/Hookshot#2702 in it; neither column's commit is named in the original description.main's run had already cached objects for the same header contents.In the game (a check, not a comparison): the game from this branch's last build, launched headless through the control bridge from a save, on RTX 3080 (NVIDIA 621.14), Ryzen 9 3900X, 64 GB, Windows 11. In play in Kokiri Forest, 27–32 fps over five samples, nothing in the log about a lost device or a crash.
Testing
Tested: the runs under Measurements (on the GitHub version) and the game-free checks this description names. Checked but not measured: the game on Windows (above): the change is build-only, and nothing in play was compared with
main.Not tested: Linux. Nothing here is platform-specific; the record's
idis the inode there.Needs other testers:
Screenshots
Nothing on screen.
Risk and rollback
Only the build's hash record (
nx2/build.py'sHASHES, saved bysave_hashes) changes. A key dropped from the record costs the next build that asks for it a read and hash of that source, not a wrong object; the earlierwritten_nsonly makes the 2 s rule stricter. There is no switch: reverting the commit is enough, and the record's format is the same either way.Reviewer notes
Carried over from NotRexed/Hookshot#2873 with the move to Longshot: the same change on Longshot's
main, with its rename applied. Its review and discussion are there.run_all.py): every check that reads the changed files (35), throughrun_all.pyon Windows with the Builder's Python and clang, rebased on GitHub'smainof that day. 31 pass; four fail the same way onmainthere:test_driver_cache_folder,test_fpx_sticky,test_linux_updateandnx2/test_dll.py(it needs a DLL build).Issues
None.
Checklist
For everyone
type(scope): description).main.python -I -B tests/run_all.pyrun and passing (any failure that also fails onmainis named above).third_party/untouched (a new folder with aPROVENANCE.mdinstead).If applicable
Assisted-by:/Co-Authored-By:trailers.docs/tested-configurations.mdfor each measured run.MKWVK_API_VERSIONbumped (gpu/vk/vk_api.h'sMkwVkHostorMkwVkRendererchanged).mainand passing here.tests/that reads changed source updated in this PR, not weakened.🤖 Generated with Claude Code
fix(build): the hash record is written under its build's start, and keeps only the keys usedto WIP: fix(build): the hash record is written under its build's start, and keeps only the keys usedBack to WIP under #48's process: this was carried over before the new template. Its description will be brought to the template and measured on Longshot (main against this PR, at named commits) when it's wanted for review; ask here if you'd like it sooner.
Description brought to Longshot's PR template (#48). Still WIP: its numbers are from the GitHub version, and it isn't rebased on current main; it gets measured on Longshot (main against this PR, at named commits) before it is marked ready.
Description moved to the template's Testing section and whole checklist (#72): what was tested, what wasn't, and what needs other testers (their test requests to open while this is WIP).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.