You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Wes McKinney (JIRA)" <ji...@apache.org> on 2017/03/22 18:13:41 UTC

[jira] [Assigned] (ARROW-621) [C++] Implement an "inline visitor" template that enables visitor-pattern-like code without virtual function dispatch

     [ https://issues.apache.org/jira/browse/ARROW-621?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wes McKinney reassigned ARROW-621:
----------------------------------

    Assignee: Wes McKinney

> [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
>
> 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
(v6.3.15#6346)