bkietz opened a new issue, #44491:
URL: https://github.com/apache/arrow/issues/44491

   ### Describe the enhancement requested
   
   In many situations, it'd be beneficial to have an error Status which was 
copyable without using the heap. For example, this is a frequent pain point 
with Result<T>. We want Result to be default constructible even if T isn't, so 
[a defaulted Result is an 
error](https://github.com/apache/arrow/blob/7a3c66ac8063bc2b2fe184cc02b1750565421f01/cpp/src/arrow/result.h#L114)
 but this requires heap allocating a Status::State which we immediately 
overwrite. Similarly, if the value or error is moved out of a Result we'd like 
to avoid managing the stored object and [wind up heap allocating a 
flag](https://github.com/apache/arrow/pull/44477).
   
   Allowing some Status objects to have static lifetime (for example, by 
tagging the `state_` pointer or adding `bool Status::State::is_static`) should 
not have an effect on the critical hot paths of [moving a 
status](https://github.com/apache/arrow/blob/7a3c66ac8063bc2b2fe184cc02b1750565421f01/cpp/src/arrow/status.h#L402)
 or [skipping deletion of ok 
status](https://github.com/apache/arrow/blob/7a3c66ac8063bc2b2fe184cc02b1750565421f01/cpp/src/arrow/status.h#L140).
 Copying will get slightly slower since we need to branch on 
`state_->is_static`, but that's already quite slow due to heap interaction.
   
   ### Component(s)
   
   C++


-- 
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: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to