[Java] Potentially inefficient variable-width vector reallocation
- Lingua principale
- Java
- Stelle
- 94
- Fork
- 152
- Merge medio
- 3g 16h
- PR unite (30g)
- 11
Descrizione
In several places in the Java codebase you can see this kind of pattern:
```java
while (vector.getDataBuffer().capacity() < toCapacity) {
vector.reallocDataBuffer();
}
```
In the event that a much larger capacity is requested, this will spuriously make several reallocations (doubling the capacity each time).
It would probably be more efficient to reallocate directly to satisfy the desired capacity.
Coincidentally, there's a `reallocDataBuffer` overload that seems to do just that.
**Reporter**: [Antoine Pitrou](https://issues.apache.org/jira/browse/ARROW-17919) / @pitrou
**Note**: *This issue was originally created as [ARROW-17919](https://issues.apache.org/jira/browse/ARROW-17919). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia individuando i punti di chiamata Java che eseguono un ciclo su vector.getDataBuffer().capacity() e chiamano reallocDataBuffer(), quindi esamina l’overload di reallocDataBuffer che accetta una capacità desiderata. Aggiorna i percorsi interessati in modo che una capacità maggiore richiesta venga soddisfatta direttamente e verifica che i test Java pertinenti coprano il comportamento di riallocazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- performance
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100