Conversation
Creates a sphere with ~100K vertices, saves it as a .mrmesh file in a temporary folder, then calls compressZip to produce a .zip archive in a second temporary folder. Verifies: - mesh and zip files both exist and are non-empty - the zip is not absurdly larger than the source (envelope sanity) Serves as a realistic end-to-end exercise of MeshLib's zip write path (libzip + zlib deflate) against mesh-sized data. Suitable for timing comparisons of different zlib backends (e.g., stock zlib vs zlib-ng compat) when added to a run's measurement targets. Placed in source/MRTest/ as MRZipCompressTests.cpp; no CMake changes needed (the existing file(GLOB SOURCES "*.cpp") picks it up).
New GTest case MRMesh.CompressManySmallFilesToZip writes 100 binary files and 100 JSON files to a temp folder (each 60 000 bytes, 12 000 000 bytes total — matching the sphere.mrmesh size from the existing CompressSphereToZip test) and compresses the folder to a .zip. Binary file content is deterministic pseudo-random bytes from a per-index-seeded LCG — low-compressibility, representative of mesh coordinate floats and similar near-incompressible payloads. JSON file content is deterministic structured-looking text padded to exactly 60 000 bytes with trailing whitespace — highly compressible, representative of scene-description metadata and logs. Pairs with CompressSphereToZip so a single run of MRTest produces two direct data points: one-large-file vs many-small-files on roughly the same total byte budget. Useful for assessing libzip's per-entry overhead (separate deflate session, CRC pass, local file header) when comparing zlib backends or compression-level changes. Per-file byte count is constant and deterministic so the aggregate input size and zip size are stable across runs (modulo whatever small variation deflate itself introduces on different zlib builds). Logs totals via spdlog::info for easy diff with the other test.
…phere # Conflicts: # source/MRTest/MRTest.vcxproj
Grantim
approved these changes
Apr 21, 2026
This was referenced Apr 21, 2026
Fedr
added a commit
that referenced
this pull request
Apr 23, 2026
Resolves conflicts from master's recent work (MRZlib move MRIOExtras→ MRMesh, #5948 adds MRZlibTests.cpp, #5933+#5960 overhaul CompressZip tests, #5957 CUDA cache-key fix, #5722 triplet-keyed vcpkg cache). Conflict resolutions: - .github/workflows/build-test-windows.yml — combined both sides' improvements in the cache key: master-side per-triplet partition (for the x64-windows-meshlib-iterator-debug triplet from #5722) AND branch-side hashFiles(overlay ports / triplets / requirements / install.bat) (from #5934, needed so overlay port changes on this PR bust the cache). Key is now vcpkg-cache-<VERSION>-<TRIPLET>-<HASH>. - source/MRMesh/MRZlib.h — accept master's version (master re-homed the file in #5944; branch had deleted it when it lived briefly in MRIOExtras). - source/MRIOExtras/MRZlib.{h,cpp} — follow master's layout: keep MRIOExtras/MRZlib.h as a forwarding header (#include <MRMesh/MRZlib.h>) and delete MRIOExtras/MRZlib.cpp (the old implementation body, now in MRMesh). - source/MRTest/MRTest.vcxproj — rename ClCompile entry from MRZlib.cpp to MRZlibTests.cpp to match master's #5948 test-file rename. Also drops the duplicate MRZlib.cpp entry. - source/MRTest/MRZlib.cpp — deleted, master renamed to MRZlibTests.cpp in #5948. - source/MRTest/MRZipCompressTests.cpp — accept master's version, which includes the level-0..9 loop (#5960) and the round-trip decompress check (#5958) on top of the branch's earlier simpler version. Branch-side novelty was just the sphere test itself, which is already on master. - source/MRTest/MRZlibTests.cpp — accept master's version, engine-agnostic assertions (tolerance-based compressedSize checks that I relaxed in the zlib-ng PR work). Branch's unique contributions — the actual point of this PR — are preserved: - thirdparty/vcpkg/ports/zlib/{portfile.cmake,vcpkg.json} -- vcpkg overlay port that builds zlib-ng in ZLIB_COMPAT=ON as a drop-in zlib replacement for every port that depends on zlib. - thirdparty/install.bat -- --overlay-ports flag added alongside the existing --overlay-triplets. - thirdparty/vcpkg/downloads/msys2-*.pkg.tar.zst -- pre-staged msys2 packages so vcpkg's pinned 2024.10.21 index doesn't hit stale msys2 mirrors during vcpkg_fixup_pkgconfig().
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.
What
Adds
source/MRTest/MRZipCompressTests.cppwith two GoogleTest cases that exercise MeshLib's zip write path (compressZip→ libzip → zlibdeflate) on deliberately different workloads. Both are designed as realistic end-to-end benchmarks — easy to scale up for backend comparisons, small by default so they don't bloat the everydayMRTestrun.MRMesh.CompressSphereToZipOne large binary file.
makeSphere({ radius=1, numMeshVertices=N }).sphere.mrmeshin aUniqueTemporaryFolder.sphere.zipin a second temp folder (so the zip isn't inside the folder being compressed).spdlog::info.Default
N = 1000vertices for the everyday run. Source comment documents bumping toN = 100_000for benchmarking (produces a ~12 MB.mrmesh— closer to realistic scene data).MRMesh.CompressManySmallFilesToZipMany small mixed-type files. Pairs with the sphere test to compare one-large-file vs many-small-files on the same
compressZipcall.numBinaryFiles.binfiles of deterministic pseudo-random bytes (LCG-seeded per index; near-incompressible, representative of mesh coordinate floats / compressed-texture blobs).numJsonFiles.jsonfiles of deterministic JSON-ish text padded to exactlybytesPerFilebytes (highly compressible, representative of scene metadata and logs).many.zip; asserts existence; logs input and output sizes.Default
(20 + 20) files × 6000 bytes = 240 KBfor everyday runs. Source comment documents bumping to(200 + 200) × 60_000 = ~24 MBfor benchmarking, matching the scaled-up sphere size.Why two tests
libzip compresses each entry independently, so per-entry overhead (local file header, CRC32 pass, separate deflate session) is a different share of
compressZip's time depending on whether the archive has one big file or many small ones. Having both tests in the same run surfaces that overhead clearly and lets compression-backend changes (e.g. PR #5932's zlib → zlib-ng overlay) be evaluated on both ends of the spectrum.Measured
compressZiptime on bumped-up sizes (for reference)Running the tests with the benchmark-size constants against MeshLib's Windows + Linux-vcpkg matrix, stock zlib vs zlib-ng (from PR #5932):
(compressZip wall time as reported by MRTest's "Main thread time tree" dump at the end of the run.)
Many-small-files consistently sees a slightly larger speedup than one-large-file on Release; Debug is ~22-24% on both workloads.
No CMake / build changes
source/MRTest/CMakeLists.txtglobs*.cpp, so the new file is picked up automatically. All dependencies (MRMesh,MRMeshSave,MRMakeSphereMesh,MRZip,MRUniqueTemporaryFolder,MRSpdlog) are already linked intoMRTest.Everyday vs benchmark runs
Defaults keep
MRTestwall time short; scaling the file-count / vertex-count constants up turns either test into a compression benchmark without other changes. Both logged sizes viaspdlog::infoflow into the Unit Tests step output; the "Main thread time tree" dump at the end of MRTest reports per-callcompressZipwall time in seconds.