Repository navigation
Cut allocation in GeoPackage reads: one row at a time, zero-copy geometry - #237
Merged
Merged
Conversation
jampukka
force-pushed
the
perf/source-gpkg-read-path
branch
from
October 16, 2026 16:53
526721b to
91deb0a
Compare
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.
This is purely a performance optimization of the
hakunapi-source-gpkgread path: it lowers allocation and GC pressure per feature. Output is unchanged and no new configuration is added.hasNext()into a single reused container, instead of batches of 250. SQLite runs in-process, so a batch saves no round trips, and it keeps every row's values (geometrybyte[]above all) reachable until the batch is consumed.ByteBufferover SQLite's own memory instead of a newbyte[]per feature. The buffer, theHakunaGeometryGPKGbuilt on it and theValueProviderare all valid only until the nexthasNext().ResultSetFeatureStreamResultSetValueProviderisNullasks the column's storage class and builds no value, andgetHakunaGeometryusesSqliteBlobReaderwhen one is available.SqliteBlobReader(reflection)PreparedStatement. Null when the sqlite-jdbc internals it needs are not found or the statement is not sqlite-jdbc's, in which casegetBytesis used.SqliteColumnTypecolumn_type, which is zero-based unlike JDBC's one-based indexes. Unwraps the statement because the connection pool hands out a proxy. Null when the statement is not SQLite's, in which caseisNullusesgetObject.keeps its own copy ofBufferedResultSet`.SqliteBlobReaderfalls back togetBytesonly when its reflective lookups fail, not when a sqlite-jdbc upgrade changes what those internals do.SqliteColumnTypecompiles againstorg.sqlite.core, so an incompatible upgrade fails at build time, but a change in what the calls return is not detected.