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-8113: [C++] Lighter weight variant<> #8472
Conversation
cpp/src/arrow/util/variant.h
Outdated
detail::conditional_t< | ||
detail::all<(std::is_copy_constructible<T>::value && | ||
std::is_copy_assignable<T>::value)...>::value, | ||
detail::explicit_copy_constructor, | ||
detail::delete_copy_constructor>::template type<Variant<T...>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to borrow this idiom to disable copy construction for Result<std::unique_ptr<T>>
drive by comment. just want to make sure we aren't using the same idioms for variant (i.e. they are compatible with C++ std)? |
@emkornfield I'm implementing a subset of |
2bfbb41
to
1875ff2
Compare
1875ff2
to
27560d0
Compare
@bkietz presumably this yields smaller code size, too? |
Updated description with build times and code sizes for a release build |
This seems to speed up the compute layer a bit.
|
@bkietz Do you plan to update this? |
27560d0
to
40430af
Compare
@pitrou yes but not soon |
40430af
to
a03eb14
Compare
Rebased, I'm writing some micro-benchmarks. |
a03eb14
to
c1b3a75
Compare
Variant benchmarks:
|
Compute overhead benchmarks:
|
@bkietz Do you know why all Github CI checks are skipped here? |
AppVeyor seems to indicate that MSVC isn't picking up / implementing the copy constructor correctly :-( |
16a69ec
to
9a725a6
Compare
@bkietz You may want to review the changes I've done. I think only docs and comments remain to be done. |
I added some docstrings. I think this is ready now. |
Hmm, I forgot to push some changes... |
9ab2798
to
50cef42
Compare
@pitrou thanks for picking this up! Looks good to me |
Ok, I'll rebase a last time to make sure this doesn't break anything. |
50cef42
to
168aa54
Compare
I don't know why but It seems that this causes g++ 9 crash: https://github.com/ursa-labs/crossbow/runs/1522097163#step:4:1237
We can reproduce this on local: (cd cpp/examples/minimal_build && docker-compose build static && docker-compose run --rm static) |
https://issues.apache.org/jira/browse/ARROW-10867 may be related. |
- [x] Unit tests for `util::Variant<>` - [x] Compilation time and code size comparison to ensure this refactoring is beneficial - [x] Benchmark comparison to ensure compute and nested parquet are not impacted - [x] More docstrings and comments Locally (release build, no ccache): ``` $ ninja ninja: no work to do. $ export OBJS=`ls src/arrow/CMakeFiles/arrow_objlib.dir/compute/**/*.o` $ git checkout master && rm $OBJS && time ninja $OBJS real 0m16.918s user 2m41.702s sys 0m2.495s $ du -h --total $OBJS | tail -n 1 total 7.3M $ git checkout 8113-Implement-a-lighter-weigh && rm $OBJS && time ninja $OBJS real 0m14.363s user 2m19.939s sys 0m2.125s $ du -h --total $OBJS | tail -n 1 6.6M total ``` Closes apache#8472 from bkietz/8113-Implement-a-lighter-weigh Lead-authored-by: Benjamin Kietzman <bengilgit@gmail.com> Co-authored-by: Antoine Pitrou <antoine@python.org> Signed-off-by: Antoine Pitrou <antoine@python.org>
util::Variant<>
Locally (release build, no ccache):