Improve build scripts and lower Crinkler runtime memory#26
Open
mandel99 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
build.batauto-detectml,link, and the newest installed Windows SDK x86 library pathbuild-tiny.batso the Crinkler build stays available without making it the default build pathtrpad.asmto shave bytes without changing visible UI text/TRANSFORM:CALLS /HASHSIZE:32as a smaller-RAM compromise than Crinkler 3.0's large default hash tableBackground
While testing this project locally with Crinkler 3.0a, one
trpad.exeinstance built with the compressed path was using far more memory than expected. The main cause turned out to be Crinkler's runtime decompressor settings rather than TinyRetroPad's editor logic.Crinkler's manual states that
/HASHSIZEcontrols the amount of memory the decompressor may use, and that this memory remains allocated for the lifetime of the program. In practice, that runtime cost was very noticeable on this project.What this PR changes
build.batml + link.exepathml.exe,link.exe, and the newest installed Windows SDK x86 lib directoryThis default build is the low-RAM build path.
build-tiny.bat/TINYIMPORT /TRANSFORM:CALLS /HASHSIZE:32trpad.asm"open"ShellExecute verb withNULL"STATIC"stringThese are conservative byte-saving changes that keep visible UI text the same.
Measured results
Local measurements on my machine:
Original repository build
2794 BEarlier Crinkler-tuned build using Crinkler's large default hash table
2708 B517 MBworking set,588 MBprivate memory,777 MBvirtual memoryBuild proposed in this PR (
/HASHSIZE:32)2731 B47.5 MBworking set,118.8 MBprivate memory,265.7 MBvirtual memorySo this PR keeps the tiny build smaller than the original repository build while dramatically reducing the worst runtime memory behavior seen with the default Crinkler settings.
Additional investigation:
TINYHEADERI also tested
Crinkler /TINYHEADERas an alternative.Relevant manual note:
TINYHEADERuses repeated linear searches instead of hashing/HASHSIZEand/HASHTRIESare ignored when/TINYHEADERis enabledMeasured TinyRetroPad result with
TINYHEADER + TINYIMPORT:2787 B4.9 MBworking set,85.3 MBprivate memory,96.9 MBvirtual memoryThat means
TINYHEADERis a real alternative if runtime memory is prioritized more than compressed size. However, for this project it was still larger than the/HASHSIZE:32tiny build:TINYHEADER:2787 B2731 BSo this PR keeps
/HASHSIZE:32because it stays below the original2794 Bbuild size while avoiding the huge memory overhead of Crinkler's larger default hash table.Tradeoff summary
2794 BTINYHEADER: much better runtime memory, but larger output than/HASHSIZE:32/HASHSIZE:32): smaller than original repo build and a more reasonable runtime compromiseVerification
build.batbuild-tiny.bat