[#32] Summarize large arrays with a hash in dump output by default#113
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the dump command’s text output to keep diffs useful while avoiding massive inline array dumps, by default summarizing large basic-type arrays as a CRC32 hash (with an option to print full array contents when needed).
Changes:
- Default dump output now summarizes basic-type arrays over 256 elements as
ArrayDataHash <crc32>. - Adds
-a/--show-large-arraysto print full large-array contents; keeps-s/--skip-large-arraysaccepted but hidden and ignored for compatibility. - Updates tests, expected-data generation, and documentation to reflect the new default and options.
Reviewed changes
Copilot reviewed 6 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| UnityDataTool/Program.cs | Adds --show-large-arrays, hides legacy --skip-large-arrays, wires new option into dump execution. |
| UnityDataTool.Tests/UnityDataToolAssetBundleTests.cs | Updates/expands CLI integration tests for new default behavior, -a, and ignored -s. |
| UnityDataTool.Tests/ExpectedDataGenerator.cs | Renames/regenerates expected dump snapshots to match new defaults and -a. |
| UnityDataTool.Tests/DumpTests.cs | Adds stdout test coverage for default hash summarization and --show-large-arrays. |
| TextDumper/TextDumperTool.cs | Implements hash summarization for large basic-type arrays and introduces MaxInlineArraySize. |
| Documentation/command-dump.md | Documents new default behavior, adds Large Arrays section, updates option table/examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
SkowronskiAndrew
marked this pull request as ready for review
July 24, 2026 19:07
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
Fixes #32.
When diffing dumps of two builds to find object changes, large arrays of basic types (mesh vertex data, texture bytes, etc.) were a problem either way: dumped in full they drown the output, and
--skip-large-arraysprinted<Skipped>, hiding real content differences. Following the idea of binary2text's-largebinaryhashonly, the dump command now summarizes arrays of basic types with more than 256 elements as a hash of their raw bytes:This is the new default behavior — a deliberate, modest compatibility break, on the theory that hiding huge arrays is the better default and the hash keeps diffs meaningful. The full content is still available with the new
-a/--show-large-arraysoption.Changes
TextDumperTool: basic-type arrays larger than 256 elements (the same threshold the skip option used) printArrayDataHash <crc32 hex>instead of their elements, unlessShowLargeArraysis set. The hash is a CRC32 computed via the existingUnityFileReader.ComputeCRC, so no new dependency (binary2text uses Unity's internal 64-bit hash, which isn't available here; for diff detection CRC32 serves the same purpose). The<Skipped>behavior is removed.-a/--show-large-arraysoption. The old-s/--skip-large-arraysis still accepted so existing scripts don't break, but it is ignored (its behavior is essentially the default now) and hidden from--helpto keep the help simple.dumpsnapshots now show hashes; thedump-ssnapshots are renamed todump-aand hold the full-content output (byte-identical to the previous defaultdumpsnapshots). New tests cover-a, the ignored-s, and a known-value hash check: theSerializationDemoint array 0..511, whose CRC32 (6feca6e2) was verified against an independent zlib crc32 computation.command-dump.mdgains a "Large Arrays" section and updated option table.Testing
dotnet test -c Release— full suite green (773 passed, 10 skipped, 0 failed).Manually verified default,
-a, and legacy-sinvocations on the LeadingEdge AssetBundles, and that-sno longer appears indump --help.