HyukjinKwon commented on code in PR #49134:
URL: https://github.com/apache/arrow/pull/49134#discussion_r2761682840
##########
cpp/src/arrow/util/small_vector.h:
##########
@@ -163,9 +163,13 @@ struct SmallVectorStorage {
other.data_ = other.static_data_;
other.dynamic_capacity_ = 0;
other.size_ = 0;
- } else if (size_ != 0) {
- // Use a compile-time memcpy size (N) for trivial types
- storage_type::move_construct_several(other.static_data_, static_data_,
size_, N);
+ } else {
+ // Reset to static storage (in case we had dynamic storage before
destroy())
+ data_ = static_data_;
Review Comment:
This is a piggyback that is technically not related to this optimization. I
found out while benchmarking. I can separate it out if anyone prefers it.
##########
cpp/src/arrow/util/small_vector.h:
##########
@@ -163,9 +163,13 @@ struct SmallVectorStorage {
other.data_ = other.static_data_;
other.dynamic_capacity_ = 0;
other.size_ = 0;
- } else if (size_ != 0) {
- // Use a compile-time memcpy size (N) for trivial types
- storage_type::move_construct_several(other.static_data_, static_data_,
size_, N);
+ } else {
+ // Reset to static storage (in case we had dynamic storage before
destroy())
+ data_ = static_data_;
Review Comment:
This is a piggyback bug fix that is technically not related to this
optimization. I found out while benchmarking. I can separate it out if anyone
prefers it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]