Details
-
New Feature
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
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:
ArrayVisitor* visitor = ...; RETURN_NOT_OK(array->Accept(visitor));
For certain types of visitors, it may be possible to create a reusable pattern like:
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"); }
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).