[Java] Potentially inefficient variable-width vector reallocation
- 主要语言
- Java
- 星标
- 94
- 派生
- 152
- 平均合并
- 3 天 16 小时
- 30 天内合并 PR
- 11
描述
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.*
贡献指南
调研方向
首先定位循环处理 vector.getDataBuffer().capacity() 并调用 reallocDataBuffer() 的 Java 调用点,然后检查接受所需容量的 reallocDataBuffer 重载。更新受影响的路径,使请求的更大容量能够直接得到满足,并验证相关的 Java 测试覆盖重新分配行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- performance
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100