Skip to content

test: CompressOneBigFileToZip (renamed, input now arch-invariant)#5979

Merged
Fedr merged 2 commits intomasterfrom
test/compress-sphere-arch-invariant
Apr 24, 2026
Merged

test: CompressOneBigFileToZip (renamed, input now arch-invariant)#5979
Fedr merged 2 commits intomasterfrom
test/compress-sphere-arch-invariant

Conversation

@Fedr
Copy link
Copy Markdown
Contributor

@Fedr Fedr commented Apr 24, 2026

Summary

Rework and rename MRMesh.CompressSphereToZip -> MRMesh.CompressOneBigFileToZip:

  • The test no longer builds a sphere mesh and serializes it via MeshSave::toMrmesh. It writes a fixed-size buffer of deterministic LCG-generated pseudo-random bytes directly.
  • The old approach made the test input slightly arch-dependent — ARM NEON vs x86 SSE/AVX round a handful of floating-point vertex coordinates differently, so the .mrmesh bytes (and therefore the resulting .zip size) differed between arm64 and x86_64 CI legs. On master run 24887440903, sphere.zip size was 59427 B on every arm64 job vs 59469 B on every x86_64 / wasm / Windows job.
  • With LCG input, every platform now runs compressZip on bit-identical bytes. PR run 24893573554 (pre-rename) confirms big.zip size: 119972 bytes on all 19 build-test jobs — zero drift across arm64/x64/wasm, macOS/Linux/Windows/emscripten, Clang 14/18/20, GCC 11/12/13/14, MSVC 2019/2022, Debug/Release, every libc, every vcpkg version, and the iterator-debug triplet.

What changed

source/MRTest/MRZipCompressTests.cpp:

  • Test renamed: CompressSphereToZip -> CompressOneBigFileToZip.
  • Input filename: sphere.mrmesh -> big.bin; output archive: sphere.zip -> big.zip.
  • makeSphere + MeshSave::toMrmesh replaced with a 119808-byte LCG buffer. The byte count matches the previous serialized-sphere size so the archive's working set is comparable to historical measurements.
  • LCG helper previously a local lambda inside CompressManySmallFilesToZip is promoted to an anonymous-namespace inline function at file scope and reused by both tests.
  • Drop includes MRMakeSphereMesh.h, MRMesh.h, MRMeshSave.h — no longer referenced.
  • Cross-reference in CompressManySmallFilesToZip's docstring + sanity-envelope comment updated to point at the new name.

Deliberate consequence: weaker compressibility

Random bytes are near-incompressible, so big.zip is ~120 KB vs the old ~59 KB. That's fine — this test is not a compression-ratio benchmark, it's an end-to-end check that the zip write path produces a non-empty archive for one large entry. CompressManySmallFilesToZip still exercises compressible (JSON) and near-incompressible (binary) payloads across every deflate level 0-9 with round-trip verification.

What this fixes (and doesn't)

  • Fixes: arm64 vs x86_64 divergence in the one-big-file zip-size output.
  • Does not fix: divergence between deflate engines (stock zlib vs zlib-ng vs libdeflate) — those genuinely produce different compressed bytes for the same input, and the test should be able to observe that.

Scope

One file, two commits (original rewrite + rename/trim). No source code / build / CI changes.

🤖 Generated with Claude Code

makeSphere's output is slightly arch-dependent -- ARM NEON vs x86
SSE/AVX produce a handful of different floating-point vertex
coordinates, which shifts the resulting .mrmesh file's bytes just
enough that the test's `sphere.zip size` came out ~74 B apart between
arm64 and x86_64 CI legs (58844 vs 58918 on run 24887440903). That
noise obscures what the test is actually meant to exercise: the zip
write path (libzip + deflate).

Swap the sphere+MeshSave::toMrmesh pair for LCG-generated deterministic
bytes, sized (119808 B) to match what makeSphere(1000 verts)+toMrmesh
used to emit so historical size measurements stay comparable. Now every
platform starts from bit-identical input to `compressZip`, so any
sphere.zip-size drift that remains comes from the deflate engine
itself.

DRY: the LCG helper that CompressManySmallFilesToZip already carried as
a local lambda is lifted to an anonymous-namespace inline function and
reused.

Drop includes MRMakeSphereMesh.h / MRMesh.h / MRMeshSave.h -- no longer
referenced from this file.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@Grantim Grantim left a comment

Choose a reason for hiding this comment

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

mb make comments a bit shorter?

The test no longer operates on a sphere mesh; rename it and its
artefacts to reflect what it actually does:

  - TEST name:         CompressSphereToZip      -> CompressOneBigFileToZip
  - source file:       sphere.mrmesh            -> big.bin
  - output archive:    sphere.zip               -> big.zip
  - vars:              meshPath/meshBytes/meshSize -> filePath/fileBytes/fileSize
  - log labels:        "sphere.mrmesh size"     -> "big.bin size"
                       "sphere.zip size"        -> "big.zip size"
                       "sphere.zip compression time" -> "big.zip compression time"

Also trim comments and drop references to the prior sphere+toMrmesh
implementation. Update cross-reference in CompressManySmallFilesToZip
to point at the new name.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Fedr Fedr changed the title test: make CompressSphereToZip input arch-invariant (pseudo-random bytes) test: CompressOneBigFileToZip (renamed, input now arch-invariant) Apr 24, 2026
@Fedr Fedr merged commit 08508ea into master Apr 24, 2026
27 checks passed
@Fedr Fedr deleted the test/compress-sphere-arch-invariant branch April 24, 2026 21:20
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.

2 participants