Skip to content

[#32] Summarize large arrays with a hash in dump output by default#113

Merged
SkowronskiAndrew merged 1 commit into
mainfrom
issue32-large-array-hash
Jul 24, 2026
Merged

[#32] Summarize large arrays with a hash in dump output by default#113
SkowronskiAndrew merged 1 commit into
mainfrom
issue32-large-array-hash

Conversation

@SkowronskiAndrew

Copy link
Copy Markdown
Collaborator

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-arrays printed <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:

m_IndexBuffer (vector)
  Array<UInt8>[2232]
    ArrayDataHash 3be77a33

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-arrays option.

Changes

  • TextDumperTool: basic-type arrays larger than 256 elements (the same threshold the skip option used) print ArrayDataHash <crc32 hex> instead of their elements, unless ShowLargeArrays is set. The hash is a CRC32 computed via the existing UnityFileReader.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.
  • CLI: new -a / --show-large-arrays option. The old -s / --skip-large-arrays is still accepted so existing scripts don't break, but it is ignored (its behavior is essentially the default now) and hidden from --help to keep the help simple.
  • Tests: the per-version expected dump snapshots now show hashes; the dump-s snapshots are renamed to dump-a and hold the full-content output (byte-identical to the previous default dump snapshots). New tests cover -a, the ignored -s, and a known-value hash check: the SerializationDemo int array 0..511, whose CRC32 (6feca6e2) was verified against an independent zlib crc32 computation.
  • Documentation: command-dump.md gains 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 -s invocations on the LeadingEdge AssetBundles, and that -s no longer appears in dump --help.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-arrays to print full large-array contents; keeps -s/--skip-large-arrays accepted 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.

Comment thread TextDumper/TextDumperTool.cs
@SkowronskiAndrew
SkowronskiAndrew marked this pull request as ready for review July 24, 2026 19:07
@SkowronskiAndrew
SkowronskiAndrew merged commit ad3ed64 into main Jul 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Dump" command - Add functionality similar to binary2text "-largebinaryhashonly"

2 participants