Reduce allocation overhead of no-op `GeospatialStatistics.Builder`
- Vorherrschende Sprache
- Java
- Sterne
- 3.1k
- Forks
- 1.6k
- Ø Merge
- 3 T. 12 Std.
- Gemergte PRs (30 T.)
- 33
Beschreibung
### Describe the enhancement requested
`GeospatialStatistics.noopBuilder()` is called for every non-geometry column in every row group. Today, each call allocates a new `NoopBuilder` (plus a `WKBReader`, `BoundingBox`, and `GeospatialTypes` that are never used), and each `build()` allocates a new `GeospatialStatistics(null, null)` that is immediately discarded.
Since `NoopBuilder` carries no state and all its methods are no-ops, it can be a singleton. Its `build()` result is equally stateless (null fields, with merge/abort guarded by null checks), so it can be cached too.
### Proposed Changes
- Make `NoopBuilder` a singleton via a static `INSTANCE` field
- Cache `build()` output as a static `EMPTY` instance
- Add a package-private super constructor that skips field initialization so the singleton doesn't allocate unused objects
This eliminates per-column-per-row-group allocations on the common path where geospatial statistics are disabled.
### Component(s)
Core
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne bei GeospatialStatistics.noopBuilder() und verfolge NoopBuilder, seine build()-Methode und die relevanten Konstruktoren. Bestätige, wie nicht verwendete Felder initialisiert werden, und überprüfe, dass der No-op-Builder und das leere Statistik-Ergebnis wiederverwendet werden, ohne das Merge- oder Abort-Verhalten zu ändern; abgeschlossen ist dies, wenn der gemeinsame Pfad diese Objekte nicht mehr bei jedem Aufruf allokiert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- performance
- Issue-Typ
- Refactoring
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 68/100