[
https://issues.apache.org/jira/browse/ARROW-621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17657653#comment-17657653
]
Rok Mihevc commented on ARROW-621:
----------------------------------
This issue has been migrated to [issue
#16249|https://github.com/apache/arrow/issues/16249] on GitHub. Please see the
[migration documentation|https://github.com/apache/arrow/issues/14542] for
further details.
> [C++] Implement an "inline visitor" template that enables
> visitor-pattern-like code without virtual function dispatch
> ---------------------------------------------------------------------------------------------------------------------
>
> Key: ARROW-621
> URL: https://issues.apache.org/jira/browse/ARROW-621
> Project: Apache Arrow
> Issue Type: New Feature
> Components: C++
> Reporter: Wes McKinney
> Assignee: Wes McKinney
> Priority: Major
> Fix For: 0.3.0
>
>
> For performance-sensitive dynamic dispatch, the current visitor pattern may
> be suboptimal due to having two virtual function dispatches per invocation.
> For example, we might have:
> {code}
> ArrayVisitor* visitor = ...;
> RETURN_NOT_OK(array->Accept(visitor));
> {code}
> For certain types of visitors, it may be possible to create a reusable
> pattern like:
> {code:language=c++}
> template <typename VISITOR>
> Status VisitArrayInline(const Array& array, VISITOR* visitor) {
> switch(array.type_id()) {
> case UINT8:
> return visitor->Visit(static_cast<const UInt8Array&>(array));
> ...
> default:
> break;
> }
> return Status::NotImplemented("Array type not implemented");
> }
> {code}
> It would be useful to have an understanding of how this design pattern
> realistically impacts performance in canonical Arrow use cases (e.g. IPC
> record batch loading / unloading).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)