-
Notifications
You must be signed in to change notification settings - Fork 3.9k
ARROW-6172 [Java] Provide benchmarks to set IntVector with different methods #5042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Agreed here with ValueHolder will perform worse. I did a refactor for Jdbc adapter in #4978 (also use writer to write data instead of ValueHolder) which has some overleap with this one |
@tianchen92 I see. Thanks. I think #4978 and this are orthogonal ways of improving the performance of JDBC adapter. |
1 similar comment
@tianchen92 I see. Thanks. I think #4978 and this are orthogonal ways of improving the performance of JDBC adapter. |
|
@liyafan82 since these changes are going to conflict, maybe we should just keep the benchmark and update JIRA description and title here? Or do you think the current code layout is better then what is #4978? |
@emkornfield I think the code layout of #4978 is better. |
@emkornfield IntBenchmarks.setIntDirectly avgt 5 15.372 ± 0.010 us/op I will do more investigations. |
|
@liyafan82 thanks, that is interesting. I'm not seeing the writer benchmark, maybe upload for a sanity check? I wonder why we have the writer if it is actually worse (maybe as some sort of abstraction)? @tianchen92 this probably affects #4978 and the work on Avro. Sorry I think I suggested writers initially instead of direct writes. |
Also surprised,with the IntBenchmarks in this PR,I add the writer benchmark as below:
These three methods all calls setSafe and the result I got is totally different in my machine.
Looks writer performs best... maybe results are affected by different machines? @emkornfield Doesn't matter, I guess maybe you could have a test also to see if this is really a problem. If writer actually has performance problem, I will do refactoring for jdbc and avro adapters, its alright. |
I'll test on my machine. Curious if you made sure to turn-off bounds checking? |
No, do you mean NullCheckingForGet? Does it only checks for get method? |
|
Thanks for clarify, I got the result above without change this flag. |
|
@tianchen92 sure. I will upload the code later, because it is in another computer. |
d0e56dd to
6fcc04b
Compare
|
@emkornfield @tianchen92 I have uploaded the benchmark. Sorry for the delay. Benchmark Mode Cnt Score Error Units |
|
Running without bounds checking turned, I saw some variations where with Writer was twice as slow as the other implementations. But on other runs I got results consistent with @tianchen92: Benchmark Mode Cnt Score Error Units Here is the code I ran for the writer tests: this is on a Mac with JDK8. |
|
Below are the results after disabling bound check & null check for get: Benchmark Mode Cnt Score Error Units The results are similar to above results. Do you think we need to switch to setting values directly? |
Given the variability in the test I'm not sure it is worth the effort at this point. If we had numbers showing it directly affects either JDBC or Avro performance, I think we should make the change then. |
6fcc04b to
b19693b
Compare
@emkornfield Sounds reasonable. I have updated the PR leaving only the benchmarks, and changed the title of the PR and JIRA accordingly. Please take a look. |
|
+1, LGTM. |
|
Thank you. |
…methods We provide benchmarks to evaluate the performance of setting IntVector in 3 different ways: through a value holder through a writer directly set the value through a set method Closes apache#5042 from liyafan82/fly_0808_jdbc1 and squashes the following commits: b19693b <liyafan82> ARROW-6172 Provide benchmarks to set IntVector with different methods Authored-by: liyafan82 <fan_li_ya@foxmail.com> Signed-off-by: Micah Kornfield <emkornfield@gmail.com>
We provide benchmarks to evaluate the performance of setting IntVector in 3 different ways:
through a value holder
through a writer
directly set the value through a set method