[Java] Potentially inefficient variable-width vector reallocation
- Langage dominant
- Java
- Étoiles
- 94
- Forks
- 152
- Merge moyen
- 3 j 16 h
- PR mergées (30 j)
- 11
Description
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.*
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par localiser les sites d’appel Java qui bouclent sur vector.getDataBuffer().capacity() et appellent reallocDataBuffer(), puis examinez la surcharge de reallocDataBuffer qui accepte une capacité souhaitée. Mettez à jour les chemins concernés afin qu’une capacité supérieure demandée soit satisfaite directement, et vérifiez que les tests Java pertinents couvrent le comportement de réallocation.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- performance
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100