You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Todd Farmer (Jira)" <ji...@apache.org> on 2022/09/06 16:51:00 UTC
[jira] [Assigned] (ARROW-16008) [C++] It is more expensive than expected to create a default Result
[ https://issues.apache.org/jira/browse/ARROW-16008?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Todd Farmer reassigned ARROW-16008:
-----------------------------------
Assignee: (was: Weston Pace)
> [C++] It is more expensive than expected to create a default Result<T>
> ----------------------------------------------------------------------
>
> Key: ARROW-16008
> URL: https://issues.apache.org/jira/browse/ARROW-16008
> Project: Apache Arrow
> Issue Type: Improvement
> Components: C++
> Reporter: Weston Pace
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 1h
> Remaining Estimate: 0h
>
> I had expected:
> {noformat}
> Result<T> my_result;
> T my_value;
> {noformat}
> to be more or less equivalent statements (as I think of Result<T> as a "T or Status variant"). However, a default result initializes itself with an error status and the error message must be allocated and copied. As a result, it is considerably more expensive (100's of ns compared to 1's of ns).
> I'm not certain how much of an issue this is however. It's possible we don't often create default results or their creation is optimized out. I prototyped a solution but did not see much change in any benchmarks. So perhaps it is not something worth changing but I figured I'd open it up to discussion.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)