Repository navigation
Conversation
minizip-ng was built without zlib (MZ_ZLIB OFF), so every zip read and write computed the CRC32 with its byte-wise software table, most of the unzip time. It now links the zlib-ng of the superbuild (PCLMUL CRC32), without fetching its own libraries. OpenGeode finds zlib-ng before minizip-ng and makes the find_dependency(ZLIB) of minizip-ng use config mode, in the build and in the exported package, so that no system zlib is picked. DEFLATE-compressed archives (e.g. a model re-zipped with a standard tool) are now readable. OpenGeode still writes stored entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bitsery default-constructs every element it deserializes: each ComponentMeshVertex, uuid map key, mesh and attribute identifier generated a random UUIDv7 immediately overwritten by the file content (1.77 M generations when loading a 900 k unique vertices model). Add non-generating uuid(BITSERY), ComponentID(BITSERY), Identifier(BITSERY) and VertexSet/PointSet(BITSERY) constructors, specialize bitsery::Access::create for uuid and ComponentID, and use them where the object is built only to be deserialized. Old file versions that do not store an identifier still get a generated one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
geode::Deserializer read through bitsery::InputStreamAdapter: every value was a virtual std::streambuf call. It now reads a geode::ByteSpan (read-only bytes, owned elsewhere) with bitsery::InputBufferAdapter, so that both a file read in memory and a slice of an archive in memory can be deserialized. Add detail::read_file_content (whole file in one read, UTF-8 path) and detail::deserialize_bytes (contexts of every registered library and the usual completion check), and use them at every native read site: identifier, relationships, unique vertices, physical properties, components, meshes, light regular grids, raster images and external time series. Native mesh, light regular grid and raster image files are now read and written with UTF-8 paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d of saving them The vertices file duplicated the "unique vertices" attribute of each component mesh: version 5 only stores the number of unique vertices and the attribute id. repair_component_vertices rebuilds the component vertices from the mesh attributes (components in registration order, i.e. the model order when loading, then increasing vertex indices) and removes links to unknown unique vertices with a warning. Versions 1 to 4 read the same bytes into a temporary vertex set and keep the previous repair. VertexIdentifier no longer owns a vertex set and attribute manager. Compatibility: files saved by this version cannot be loaded by earlier releases (they do not know the version 5 of the vertices file); files saved by earlier releases still load. Tests: component vertices are compared as sets after a reload, since the order after load is the rebuild order (checked separately, and identical for two loads); the standalone save/load test loads the components and repairs; legacy v20_2 BRep/Section files cover the old format, and the missing attribute restoration uses the legacy BRep file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Loading a BRep or a Section extracted every entry of the archive to the temporary directory, then read the files back. The archive is now read in place through geode::detail::InputFiles: the archive is memory-mapped (positional reads if it cannot be mapped), stored entries are zero-copy slices of the mapping, deflated entries are inflated with zlib-ng, and the CRC-32 of each entry is checked when it is read (a mismatch is a data error naming the entry). The pages of an entry leave the process memory once it is deserialized. Native mesh, light regular grid and raster inputs read from bytes (Input::read_bytes); other inputs of an archive entry get a temporary file. Plain files (meshes loaded by path, model directories) are memory-mapped instead of copied into a buffer. The load_* builder methods taking a directory are kept as wrappers of the directory input files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
minizip-ng is only exported by static OpenGeode builds, so the tests configured against a shared install could not find MINIZIP::minizip-ng. DEFLATE archives are now pre-generated data files (Python zipfile, ZIP_DEFLATED); stored archives are written by the tests themselves or by geode::ZipFile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…type Input::read_bytes fills a vector given by reference and returns false when the input can only read files, instead of returning std::optional of the objects: MSVC instantiates the inline virtual body with the class, which needed the complete mesh type in headers that only forward declare it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Faster loading of native models and meshes. On a 298 MB structural model (39 blocks, 4.9 M tets, 899 k unique vertices),
load_structural_modelgoes from 1.48 s to 0.36 s on the existing file, and to 0.19 s once the file is re-saved. Goes with the OpenGeode-Geosciences PR on the same branch name (perf/faster-loading).Benchmarks (idle machine, Release, clang, median of 7 runs)
Whole load of
3_meshed_300m.og_strm, throughload_structural_model:nextThe extra max RSS on the old file is memory-mapped archive pages: clean, file-backed and reclaimable.
Gain of each commit, against the previous commit in the same session. The model is loaded as a BRep from the same archive.
.og_tso3d.og_tso3dChanges
MZ_ZLIBon the zlib-ng we already build, which gives a hardware CRC32 and support for DEFLATE archives.libOpenGeode_basic(--exclude-libswith GNU ld/lld), so a systemlibz(e.g. in Python) cannot take their place.uuid( BITSERY ),bitsery::Access::createspecializations and(BITSERY)constructors onIdentifier,VertexSetand the meshes. Loading this model generates 5 k uuids instead of 1.77 M.geode::Deserializernow reads ageode::ByteSpanthroughbitsery::InputBufferAdapter. Mesh, raster and grid readers and writers open UTF-8 paths.repair_component_verticesrebuilds them from each mesh's unique vertex attribute, in a fixed order: corners, lines, surfaces, blocks, each in model order, then increasing vertex index.detail::InputFileshas a directory implementation and an archive implementation. The archive is memory-mapped: STORED entries are read without copying, DEFLATE entries are inflated, and every entry's CRC is checked by the thread that loads it. If the archive cannot be mapped, entries are read with positional reads.const detail::InputFiles&. The publicBuilder::load_*( directory )methods remain as wrappers.Input::read_bytesfor loading from memory. An input that cannot read from memory gets a temporary file.Notes for review
load_brep_files,load_section_filesandComponentsStorage::load_componentstakeInputFiles.Deserializertype changed, so code that builds it on a stream must switch todetail::deserialize_bytes, or to aByteSpanfromdetail::map_file_content.component_mesh_vertices( unique_vertex )follows the order above, which can differ from the order before saving. Code that takesfront()gets a vertex at the same position but possibly from another component, so reference outputs downstream may change.CreateFileMappingW/MapViewOfFile) has not been compiled locally; this is its first CI run. Symbol hiding only applies to GNU ld/lld.Tests
test-input-files: directory and archive, CRC, corrupted DEFLATE, truncated entries, temp-file errors.test-mesh-input-bytestest-model-archive-input: every test model loaded from the archive and from the extracted directory; nothing written toTMPDIR; a corrupted entry is named in the error.test-model-deflate-archivetest-hidden-zlib-symbolsbackward_io/v20_2(BRep and Section, VertexIdentifier v4).🤖 Generated with Claude Code