Load edge visibility accessors as typed arrays to cut JS heap use#13643
Open
markschlosseratbentley wants to merge 5 commits into
Open
Load edge visibility accessors as typed arrays to cut JS heap use#13643markschlosseratbentley wants to merge 5 commits into
markschlosseratbentley wants to merge 5 commits into
Conversation
Contributor
|
Thank you for the pull request, @markschlosseratbentley! ✅ We can confirm we have a CLA on file for you. |
…to cut JS heap use'
2 tasks
markschlosseratbentley
marked this pull request as ready for review
July 23, 2026 12:29
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.
Description
GltfLoader.loadEdgeVisibilityloaded edge-visibility accessors (visibility,silhouetteNormals,lineStrings[].indices) vialoadAccessor, converting binary data into plain JS number arrays retained for the tileset's lifetime. On edge-heavy tilesets this inflated JS heap ~12x (39.5 MB -> ~460 MB on a 306-tile test dataset).loadAccessorTypedArrayinsteadEdgeVisibilityPipelineStagenow readssilhouetteNormalsas a flat packedInt8Array(wasCartesian3[])Measured heap delta after fix: ~460 MB -> 45 MB (Tafe_Sydney), 31.5 MB -> 6.6 MB (04_Plant). FPS/GPU memory unchanged.
Note:
primitive.edgeVisibility.silhouetteNormalschanges shape fromCartesian3[]to flatInt8Array(internal/undocumented API).Explanation
Plain JS number arrays store elements as V8 tagged values or heap-allocated doubles rather than raw bytes, so 1-byte binary values inflate several-fold; a heap allocation profile attributed ~340 MB of the regression to
loadAccessorValues. Typed arrays store the data as a compact binary buffer, 1 byte per element.Issue number and link
#13640
Testing plan
gulp test --webglStub), including new typed-array assertions and a value-level silhouette-normal decode test.Author checklist
CONTRIBUTORS.mdCHANGES.mdwith a short summary of my changeAI acknowledgment
If yes, I used the following Tools(s) and/or Service(s):
GitHub Copilot
If yes, I used the following Model(s):
Claude Fable 5