Reduce allocation overhead of no-op `GeospatialStatistics.Builder`
- 主要言語
- Java
- スター
- 3.1k
- フォーク
- 1.6k
- 平均マージ
- 3日 12時間
- マージ済み PR(30日)
- 33
説明
### 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
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
GeospatialStatistics.noopBuilder() から開始し、NoopBuilder、その build() メソッド、および関連するコンストラクターを追跡します。未使用のフィールドがどのように初期化されるかを確認し、merge や abort の動作を変更せずに no-op builder と空の統計結果が再利用されることを検証します。完了条件は、共通パスでこれらのオブジェクトが呼び出しごとに割り当てられなくなることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- performance
- issue の種類
- リファクタリング
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 68/100