Reduce allocation overhead of no-op `GeospatialStatistics.Builder`
- Langage dominant
- Java
- Étoiles
- 3.1k
- Forks
- 1.6k
- Merge moyen
- 3 j 12 h
- PR mergées (30 j)
- 33
Description
### 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
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par GeospatialStatistics.noopBuilder() et suivez NoopBuilder, sa méthode build() et les constructeurs concernés. Confirmez comment les champs inutilisés sont initialisés et vérifiez que le builder no-op et le résultat de statistiques vide sont réutilisés sans modifier le comportement de merge ou d’abort ; c’est terminé lorsque le chemin courant n’alloue plus ces objets à chaque appel.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- performance
- Type d'issue
- Refactorisation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 68/100