mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-18 12:08:38 +00:00
gen.py lifted every chunk on each run and only skipped rewriting the ones whose text came out the same, so a rebuild after one changed code cheat still spent the whole lift (102 s on 12 cores, 178 s with 4 workers) to recompile two chunks. A chunk's text depends only on the generator's sources and options, the module and the function starts discovered from it, the chunk's number and functions, and the patch sites and spin waits inside its address range, so the SHA-256 of these is now its key. <mod>/lift_cache.json records each chunk's key with the SHA-256, size and mtime of its file and the statistics and folded ranges the manifest and folded.txt need, under a digest of the entry. A chunk whose entry is intact, whose key matches and whose file is unchanged is reused without a worker; no pool starts when nothing is left to lift. The cache is written after the manifest, and a failed write only warns. --no-cache, or TOTK_LIFT_CACHE=0 for the installer's lift, lifts everything. On 1.4.3 with the installed mods' cheats, a run with unchanged inputs takes 4 s and one with a changed cheat word lifts one chunk in 7 s. Its output equals a --no-cache lift into an empty folder and the previous gen.py's output byte for byte. tests/lift_cache_test.py checks reuse and invalidation on a module it makes itself.