Reduce memory usage in changelog generation and release copying#126
Open
JakeShirley wants to merge 1 commit intomainfrom
Open
Reduce memory usage in changelog generation and release copying#126JakeShirley wants to merge 1 commit intomainfrom
JakeShirley wants to merge 1 commit intomainfrom
Conversation
zachcampbellskyboxlabs
approved these changes
Apr 17, 2026
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
Reduces peak memory usage during changelog generation by eliminating redundant object cloning.
Changes
1. Share changelog by reference instead of N deep copies (
changelog.ts)Previously, each module in a group received its own
JSON.parse(serializedChangelog). For large modules like@minecraft/serverwith 36 version groups x N modules, this created hundreds of MB of identical objects. Now we parse once and assign the same reference to all modules in the group. This is safe because nothing mutates the originals beforeMinecraftRelease.copy()deep-clones them downstream.2. Remove unnecessary
deepCopyJsonof layout keys (changelog.ts)Layout keys (e.g.
name) are always primitives (strings/numbers) that don't need deep copying.3. Batch
release.copy()serialization (MinecraftRelease.ts)Refactored
copy()to serialize each module array as a whole (JSON.parse(JSON.stringify(arr))) instead of per-element, using a genericdeepCopyArray<T>helper. Reduces JSON.stringify/parse call overhead.Benchmark (5 Minecraft releases, 285 MB metadata input)
Output is byte-identical. All 57 snapshot tests pass.