Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve perf when writing MBTiles #31

Merged
merged 2 commits into from
Aug 12, 2024

Conversation

danzel
Copy link
Contributor

@danzel danzel commented Aug 2, 2024

We have an internal application where writing MBTiles is the performance bottleneck, making these changes gave us some meaningful improvements.

  1. Instead of having each Encode method return a new list (or yielding results) and then adding them to the Geometry using AddRange, pass in the Geometry list and add the contents directly.
    This gives us a ~12% performance increase in our internal testing.

  2. If id is a ulong, set it directly instead of ToString and Parse it. Another small performance improvement.

@CLAassistant
Copy link

CLAassistant commented Aug 2, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@FObermaier FObermaier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this contribution

@FObermaier FObermaier merged commit 6a30b00 into NetTopologySuite:develop Aug 12, 2024
4 checks passed
FObermaier added a commit that referenced this pull request Aug 14, 2024
* Reset currentX and currentY when encoded data is not written
* Add provided unit test slightly modified
* Check extent of polygon's interior rings prior to encoding
* Add extent test for lineal geometries
* Fix failure case
* Improve performance when writing MBTiles (#31)
* Write encoded geometries directly to the destination list
* If id is ulong use it directly
* Reset currentX and currentY when encoded data is not written
* Add provided unit test slightly modified
* Check extent of polygon's interior rings prior to encoding
* Add extent test for lineal geometries
* Add min[Lineal|Polygonal]Extent to MapBoxTileWriter
* Add ExtentInPixels to TileGeometryTransform
* Add HasValidExtent functions to EncodeTo functions for lineal and polygonal geometries
* Expose default values for min[Lineal|Polygonal]Extent and idAttributeName
* Add unit test for min[Lineal|Polygonal]Extent
* Fix GitHub Actions criticism
* Update README.md

* Update frameworks
* Update action versions

closes #29

---------

Co-authored-by: Dave Leaver <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants