apache / apache/arrow-java

[java][Vector][Performance] PromotableWriter.setPosition resolving to itable dispatch on C2 compiled path.

オープン
#1,238 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
Type: enhancement
主要言語
Java
スター
94
フォーク
152
平均マージ
3日 16時間
マージ済み PR(30日)
11

説明

### Describe the enhancement requested

This is my first issue report here. Thanks for all the wonderful work.

Usecase: I am planning to replace our parquet-mr based parquet writer with arrow-java to arrow-rs via SharedMemory IPC. Each Kubernetes pod writes about 3 to 4 thousand event per second per pod. The original schema does have some heavy nesting (thrift influence) and schema redesign while desirable but is a much longer exercise. In the process of proof of concept, was able to get the whole flow working but when running some sample shadow flows, saw that all dispatch via
```java
PromotableWriter.setPosition(int index)
```
would result in a itable dispatch. Looking at it, there could be multiple implementations of FieldWriter's at callsite and C2 fails to convert it into monomorphic or bimorphic calls. Was able to get a synthetic benchmark setup inside the performance module and can see the same in JMH runs too.

Image

[This](https://shipilev.net/blog/2015/black-magic-method-dispatch/) wonderful writeup by Aleksey Shipilev speaks about it in great detail.
We can convert the itable dispatch to a vtable dispatch by the method to be dispatched over AbstractFieldWriter. I will do more tests around the same and can submit the PR here. Tried searching over the issues and this doesn't seem to have been reported so far. Just curious if I am doing something wrong when using ListVector's (and hence holding back attaching the PR straight away!).

Just pasting the screen grab of the actual struct writer used in the benchmark. The benchmark is produced by claude (as one can make it out looking at the comments, but it seemed pretty ok to me).

Image

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start with PromotableWriter.setPosition(int) and the AbstractFieldWriter call path described in the issue. Reproduce the dispatch behavior using the JMH benchmark in the performance module, then verify that the resulting change improves the measured dispatch without regressions.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
performance
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。