Skip to content

ARROW-5752: [Java] Improve the performance of ArrowBuf#setZero#4715

Closed
liyafan82 wants to merge 1 commit into
apache:masterfrom
liyafan82:fly_0627_zero
Closed

ARROW-5752: [Java] Improve the performance of ArrowBuf#setZero#4715
liyafan82 wants to merge 1 commit into
apache:masterfrom
liyafan82:fly_0627_zero

Conversation

@liyafan82
Copy link
Copy Markdown
Contributor

The current implementation involves repeated calls of setLong, setInt & setByte. It is more efficient to directly call the native function.

Performance improve by 4.8x
before:
ArrowBufBenchmarks.setZero avgt 5 319616.675 ± 918.298 ns/op
after:
ArrowBufBenchmarks.setZero avgt 5 66616.553 ± 202.525 ns/op

@emkornfield
Copy link
Copy Markdown
Contributor

LGTM, @praveenbingo @pravindra any concerns?

@siddharthteotia
Copy link
Copy Markdown
Contributor

LGTM. I am just curious what the native operation does? I mean does it not write word by word?

@liyafan82
Copy link
Copy Markdown
Contributor Author

LGTM. I am just curious what the native operation does? I mean does it not write word by word?

The native code also writes data word by word. However, the performance of native code is higher.
For details, please see Copy::fill_to_memory_atomic in https://github.com/JetBrains/jdk8u_hotspot/blob/master/src/share/vm/utilities/copy.cpp

@emkornfield
Copy link
Copy Markdown
Contributor

@liyafan82 failure looks unrelated but I would like to make sure this doesn't affect gandiva in some way, could you retry?

@pravindra
Copy link
Copy Markdown
Contributor

Nice one. thanks for fixing this !

@pravindra
Copy link
Copy Markdown
Contributor

@liyafan82 failure looks unrelated but I would like to make sure this doesn't affect gandiva in some way, could you retry?

i retriggered the build, it finished successfully.

@emkornfield
Copy link
Copy Markdown
Contributor

merging

@liyafan82
Copy link
Copy Markdown
Contributor Author

@liyafan82 failure looks unrelated but I would like to make sure this doesn't affect gandiva in some way, could you retry?

i retriggered the build, it finished successfully.

@pravindra thanks a lot for your effort.

nealrichardson pushed a commit to nealrichardson/arrow that referenced this pull request Jun 27, 2019
The current implementation involves repeated calls of setLong, setInt & setByte. It is more efficient to directly call the native function.

Performance improve by 4.8x
before:
ArrowBufBenchmarks.setZero  avgt    5  319616.675 ± 918.298  ns/op
after:
ArrowBufBenchmarks.setZero  avgt    5  66616.553 ± 202.525  ns/op

Author: liyafan82 <fan_li_ya@foxmail.com>

Closes apache#4715 from liyafan82/fly_0627_zero and squashes the following commits:

545f135 <liyafan82>  Improve the performance of ArrowBuf#setZero
pribor pushed a commit to GlobalWebIndex/arrow that referenced this pull request Oct 24, 2025
The current implementation involves repeated calls of setLong, setInt & setByte. It is more efficient to directly call the native function.

Performance improve by 4.8x
before:
ArrowBufBenchmarks.setZero  avgt    5  319616.675 ± 918.298  ns/op
after:
ArrowBufBenchmarks.setZero  avgt    5  66616.553 ± 202.525  ns/op

Author: liyafan82 <fan_li_ya@foxmail.com>

Closes apache#4715 from liyafan82/fly_0627_zero and squashes the following commits:

545f135 <liyafan82>  Improve the performance of ArrowBuf#setZero
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants