You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/10/04 17:23:59 UTC
[PR] Specialize thrift (#4891) [arrow-rs]
tustvold opened a new pull request, #4892:
URL: https://github.com/apache/arrow-rs/pull/4892
_Draft as needs cleaning up_
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes #4891
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
We aren't using `TCompactSliceInputProtocol` and yet are already seeing non-trivial performance benefits from where we are
```
open(default) time: [23.783 µs 23.801 µs 23.822 µs]
change: [-10.316% -10.211% -10.106%] (p = 0.00 < 0.05)
Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild
open(page index) time: [705.79 µs 705.98 µs 706.18 µs]
change: [-33.072% -33.014% -32.960%] (p = 0.00 < 0.05)
Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
2 (2.00%) high mild
```
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!---
If there are any breaking changes to public APIs, please add the `breaking change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Specialize thrift (#4891) [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on code in PR #4892:
URL: https://github.com/apache/arrow-rs/pull/4892#discussion_r1346383547
##########
parquet/src/arrow/async_reader/metadata.rs:
##########
@@ -95,16 +94,14 @@ impl<F: MetadataFetch> MetadataLoader<F> {
// Did not fetch the entire file metadata in the initial read, need to make a second request
let (metadata, remainder) = if length > suffix_len - 8 {
let metadata_start = file_size - length - 8;
- let remaining_metadata = fetch.fetch(metadata_start..footer_start).await?;
-
- let reader = remaining_metadata.as_ref().chain(&suffix[..suffix_len - 8]);
- (read_metadata(reader)?, None)
+ let meta = fetch.fetch(metadata_start..file_size - 8).await?;
Review Comment:
This does mean we re-read data, however, in almost all cases this will be irrelevant in the grand scheme of things.
Another option would be to concatenate the data here, but this might be less efficient, e.g. the underlying AsyncFileReader is just slicing a Bytes from memory.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Specialize Thrift Decoding (~40% Faster) (#4891) [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #4892:
URL: https://github.com/apache/arrow-rs/pull/4892#discussion_r1346404836
##########
parquet/CONTRIBUTING.md:
##########
@@ -65,7 +65,7 @@ To compile and view in the browser, run `cargo doc --no-deps --open`.
To generate the parquet format (thrift definitions) code run from the repository root run
```
-$ docker run -v $(pwd):/thrift/src -it archlinux pacman -Sy --noconfirm thrift && wget https://raw.githubusercontent.com/apache/parquet-format/apache-parquet-format-2.9.0/src/main/thrift/parquet.thrift -O /tmp/parquet.thrift && thrift --gen rs /tmp/parquet.thrift && sed -i '/use thrift::server::TProcessor;/d' parquet.rs && mv parquet.rs parquet/src/format.rs
+$ docker run -v $(pwd):/thrift/src -it archlinux pacman -Sy --noconfirm thrift && wget https://raw.githubusercontent.com/apache/parquet-format/master/src/main/thrift/parquet.thrift -O /tmp/parquet.thrift && thrift --gen rs /tmp/parquet.thrift && sed -i '/use thrift::server::TProcessor;/d' parquet.rs && sed -i 's/impl TSerializable for/impl crate::thrift::TSerializable for/g' parquet.rs && sed -i 's/fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol)/fn write_to_out_protocol<T: TOutputProtocol>(\&self, o_prot: \&mut T)/g' parquet.rs && sed -i 's/fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol)/fn read_from_in_protocol<T: TInputProtocol>(i_prot: \&mut T)/g' parquet.rs && mv parquet.rs parquet/src/format.rs
Review Comment:
Somewhere we should encode the exact version of the thrift file that the currently checked in `metadata` came from, I think. By referring to master it will "depend" on when the script got run
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Specialize Thrift Decoding (~40% Faster) (#4891) [arrow-rs]
Posted by "crepererum (via GitHub)" <gi...@apache.org>.
crepererum commented on code in PR #4892:
URL: https://github.com/apache/arrow-rs/pull/4892#discussion_r1350472806
##########
parquet/CONTRIBUTING.md:
##########
@@ -65,7 +65,7 @@ To compile and view in the browser, run `cargo doc --no-deps --open`.
To generate the parquet format (thrift definitions) code run from the repository root run
```
-$ docker run -v $(pwd):/thrift/src -it archlinux pacman -Sy --noconfirm thrift && wget https://raw.githubusercontent.com/apache/parquet-format/apache-parquet-format-2.9.0/src/main/thrift/parquet.thrift -O /tmp/parquet.thrift && thrift --gen rs /tmp/parquet.thrift && sed -i '/use thrift::server::TProcessor;/d' parquet.rs && mv parquet.rs parquet/src/format.rs
+$ docker run -v $(pwd):/thrift/src -it archlinux pacman -Sy --noconfirm thrift && wget https://raw.githubusercontent.com/apache/parquet-format/master/src/main/thrift/parquet.thrift -O /tmp/parquet.thrift && thrift --gen rs /tmp/parquet.thrift && sed -i '/use thrift::server::TProcessor;/d' parquet.rs && sed -i 's/impl TSerializable for/impl crate::thrift::TSerializable for/g' parquet.rs && sed -i 's/fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol)/fn write_to_out_protocol<T: TOutputProtocol>(\&self, o_prot: \&mut T)/g' parquet.rs && sed -i 's/fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol)/fn read_from_in_protocol<T: TInputProtocol>(i_prot: \&mut T)/g' parquet.rs && mv parquet.rs parquet/src/format.rs
Review Comment:
maybe place this into a script file?
Also I think the master commit should be pinned here, so that the output is reproducible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Specialize Thrift Decoding (~40% Faster) (#4891) [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold merged PR #4892:
URL: https://github.com/apache/arrow-rs/pull/4892
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Specialize thrift (#4891) [arrow-rs]
Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on PR #4892:
URL: https://github.com/apache/arrow-rs/pull/4892#issuecomment-1747533895
With the latest changes
```
open(default) time: [15.697 µs 15.705 µs 15.714 µs]
change: [-40.766% -40.682% -40.602%] (p = 0.00 < 0.05)
Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
5 (5.00%) high mild
5 (5.00%) high severe
open(page index) time: [691.76 µs 692.23 µs 692.72 µs]
change: [-34.457% -34.394% -34.334%] (p = 0.00 < 0.05)
Performance has improved.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Specialize Thrift Decoding (~40% Faster) (#4891) [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #4892:
URL: https://github.com/apache/arrow-rs/pull/4892#issuecomment-1747566424
I think it is important to note that this is related to making Parquet reading faster - as the connection between TCompactSliceInputProtocol and reading parquet metadata may not be obvious
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org