[Extractors] Cache model reads and parallelize the vmap assembler - #7
Merged
Merged
Conversation
The assembler's per-spawn bound calculation re-read and re-parsed each
model file once per spawn -- millions of redundant reads. Cache each
unique model's vertices on first read (iModelVertexCache) and reuse them
across all of that model's spawns.
Restructure convertWorld2 into three phases:
1. one global parallel pass computing every spawn's transformed bound
(replaces the per-map bound loop, removing the giant-continent-map
thread imbalance),
2. a serial per-map pass building and writing the BIH .vmtree/.vmtile,
3. a parallel convert-model-files pass.
Thread count comes from the existing -t/--threads option (0 = auto-detect
cores, 1 = serial). Output is unchanged: a byte-for-byte compare of the
assembled vmaps (cached vs. original) is identical. On a full 4.3.4
extraction the assemble phase drops ~81s -> ~17s threaded, and the cache
alone cuts the serial assemble ~81s -> ~24s.
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.
Builds on the merged
--threadsextractor work (#5): parallelizes the vmap assembler (TileAssembler::convertWorld2), the last fully-serial phase.Algorithmic win (helps serial too):
calculateTransformedBoundre-read and re-parsed each model file once per spawn — millions of redundant reads. A per-model vertex cache (iModelVertexCache) reads each unique model once and reuses it across all its spawns.Parallelism:
convertWorld2is restructured into three phases —.vmtree/.vmtile,Thread count comes from the existing
-t/--threadsoption (0= auto-detect cores,1= serial).Correctness: output is unchanged — on the mangosthree in-tree extractor a byte-for-byte compare of the assembled vmaps (cached+parallel vs. the original serial assembler, same
dir_bin) is identical. Built green here.Numbers (full 4.3.4 reference extraction): assemble phase ~81s → ~17s threaded; the cache alone cuts the serial assemble ~81s → ~24s.
This change is