Repository navigation
Conversation
BitmapLayer now compares bounds by value before it builds a new mesh. Tile layers give each sublayer a new bounds array on each update. In a CustomProjectionView, each new mesh projects many vertices again. CustomProjectionViewport.projectPosition now only scales positions that are already packed in its own CRS. Before, polygon triangulation converted each packed vertex to WGS84 and back. Add tests for the converter call counts and for mesh reuse.
[Medium impact] The PR appears safe to merge; no new actionable issues were found. SummaryRemoves repeated coordinate conversions and bitmap mesh rebuilds.
Reviews (3) · Last reviewed commit: "Merge master into codex/custom-projectio..." · Reviewed by Greptile |
When extensions change, BitmapLayer makes a new model. With bounds that are equal by value, the mesh is kept, so the rebuild branch that sets the vertex count does not run, and the new model draws nothing. Set the count from the kept mesh when the model is replaced.
Keep both new BitmapLayer tests at the end of bitmap-layer.spec.ts.
This was referenced Nov 16, 2026
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
33 of 41 tasks
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
This branch has not been deployed
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.
Closes #11125
For #10739
Background
BitmapLayer.updateStatecomparesboundsby reference. ATileLayerrenderSubLayerscallback returns a newboundsarray on each render, so each sublayer update builds the mesh again. In a_CustomProjectionView, a refined mesh projects many vertices.SolidPolygonLayertriangulates withviewport.projectPosition(position, {sourceCrs: packedCrs}).CustomProjectionViewportconverts these packed positions to WGS84 and back before it scales them.Change List
BitmapLayer: compareboundsby value before the mesh rebuildCustomProjectionViewport.projectPosition: scale positions packed in the view CRSThe
sourceCrscheck is an identity check againstviewport.crs, the descriptor thatgetPreprojectionreturns aspackedCrs. A descriptor of another CRS, or of the same CRS from another projection engine (#11112), still converts through WGS84. The change adds no cache.Before / After
A basemap of vector and raster tiles in a
_CustomProjectionView(UTM zone 32N), headed Chromium. The script makes 30 wheel steps out and 30 in, two times. Medians of 3 runs per variant, with alternating runs. The machine had a high load (load average 37 to 50), so compare the variants, not the absolute values.Unit tests:
SolidPolygonLayerdoes one forward conversion per vertex (before: two forward and one inverse).BitmapLayerkeeps its mesh whenboundsare equal by value.Questions
This PR touches the same
boundscondition as #11030. TheimageMappingbranch in #11031 comparesboundsby reference too. Should that branch also compare by value?Note
Low Risk
Low risk performance optimizations that avoid redundant bounds-driven mesh recomputations and CRS conversions without altering external projection APIs.
Overview
Optimizes rendering performance by eliminating redundant mesh rebuilds and coordinate conversions in custom projection workflows.
In
BitmapLayer,boundsare now compared by value viadeepEqualrather than reference to avoid recreating costly meshes when callers supply new array instances with identical values. In addition, the vertex count is now preserved on recreated models when extensions change.In
CustomProjectionViewport.projectPosition, coordinates already expressed in the viewport's CRS (sourceCrs === this.crs) now bypass the intermediate round-trip through WGS84 and are scaled directly to common space.Reviewed by Cursor Bugbot for commit 3f6743b. Bugbot is set up for automated code reviews on this repo. Configure here.