Skip to content
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

ARROW-13534: [C++] Improve csv chunker #10859

Closed
wants to merge 1 commit into from

Conversation

cyb70289
Copy link
Contributor

@cyb70289 cyb70289 commented Aug 3, 2021

Add hints to help compiler deleting dead code per template augments.
Tested with clang-10, gcc-9.3, on x86 and Arm, observed ~20% uplift for
quoting=false benchmark. Probably due to better code locality.

Add hints to help compiler deleting dead code per template augments.
Tested with clang-10, gcc-9.3, on x86 and Arm, observed ~20% uplift for
quoting=false benchmark. Probably due to better code locality.
@github-actions
Copy link

github-actions bot commented Aug 3, 2021

@cyb70289
Copy link
Contributor Author

cyb70289 commented Aug 3, 2021

ChunkCSVEscapedBlock test (quoting=false) improves significantly.
Below result is on xeon gold 5128. Similar result from Arm.

$ release/arrow-csv-parser-benchmark --benchmark_filter="ChunkCSV.*"

clang-10
Before

ChunkCSVQuotedBlock         156626 ns       156625 ns         4483 bytes_per_second=1035.11M/s
ChunkCSVEscapedBlock        271061 ns       271063 ns         2585 bytes_per_second=562.925M/s
ChunkCSVNoNewlinesBlock        214 ns          214 ns      3278776 bytes_per_second=0/s

After

ChunkCSVQuotedBlock         156100 ns       156100 ns         4483 bytes_per_second=1038.6M/s
ChunkCSVEscapedBlock        204164 ns       204164 ns         3423 bytes_per_second=747.381M/s
ChunkCSVNoNewlinesBlock        214 ns          214 ns      3286563 bytes_per_second=0/s

gcc-9.3
Before

ChunkCSVQuotedBlock         218153 ns       218151 ns         3208 bytes_per_second=743.176M/s
ChunkCSVEscapedBlock        225251 ns       225251 ns         3107 bytes_per_second=677.414M/s
ChunkCSVNoNewlinesBlock        202 ns          202 ns      3467515 bytes_per_second=0/s

After

ChunkCSVQuotedBlock         222775 ns       222776 ns         3141 bytes_per_second=727.747M/s
ChunkCSVEscapedBlock        186540 ns       186541 ns         3751 bytes_per_second=817.984M/s
ChunkCSVNoNewlinesBlock        202 ns          202 ns      3469361 bytes_per_second=0/s

@pitrou
Copy link
Member

pitrou commented Aug 3, 2021

Nice! Can the same technique be applied to the CSV parser?

@cyb70289
Copy link
Contributor Author

cyb70289 commented Aug 3, 2021

Didn't investigate deep but it looks easy for compiler to figure out the dead code in CSV parser.
CSV chunker::ReadLine is "stateful", so it's harder for compiler.

@pitrou pitrou closed this in 6cacfff Aug 3, 2021
@cyb70289 cyb70289 deleted the 13534-csv-chunker branch August 16, 2021 02:18
michalursa pushed a commit to michalursa/arrow that referenced this pull request Aug 17, 2021
Add hints to help compiler deleting dead code per template augments.
Tested with clang-10, gcc-9.3, on x86 and Arm, observed ~20% uplift for
quoting=false benchmark. Probably due to better code locality.

Closes apache#10859 from cyb70289/13534-csv-chunker

Authored-by: Yibo Cai <yibo.cai@arm.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants