reduce memory use of pbchunk conversion #820
Merged
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.
C code generated by the pbchunk conversion is especially verbose, with long macro names for simple operations and lots of comments to reflect source instructions. Generation of that code was formerly rendering to text in memory, and then splitting into the output files, which turns out to use a lot of memory. Converting to text at the last minute can have a much lower peak memory use.
If memory is at a premimum, then rendering to a temporary file would work even better, but this change already brings memory use in line with other build actions without having to deal with a temporary file. Memory use could also be reduced by dropping comments that connect to source instructions; again, though, doesn't seem necessary for now.
Related to racket/racket#4955.