AntoinePrv opened a new issue, #49835: URL: https://github.com/apache/arrow/issues/49835
### Describe the enhancement requested Right now the `DynamicDispatch` makes no assumption on the `DynamicFunction::implementations()`. However in practice we can assume the implementations to be a compile-time sequence: each available must have been compiled so there is no possibility to add more at runtime (doing so would require a `dlopen` style plugin loading, which I don't believe is what we want to go towards). With C++17 and CTAD, it is straightforward to use a static array without needing with compile-time array sizes. For e.g. it is already done with: https://github.com/apache/arrow/blob/e8b7b4e35e231a0fcdbfa74f6a6b0075108dd5dc/cpp/src/arrow/util/bpacking.cc#L35-L47 There are actually few places to change such as: https://github.com/apache/arrow/blob/e8b7b4e35e231a0fcdbfa74f6a6b0075108dd5dc/cpp/src/parquet/level_comparison.cc#L57-L63 This will be a small immediate yet negligible improvement (the std::vector is actually just parsed once). The big win, is to use that information to skip dynamic dispatch altogether when there is only one implementation available, as done (verbosly) here: https://github.com/apache/arrow/blob/e8b7b4e35e231a0fcdbfa74f6a6b0075108dd5dc/cpp/src/arrow/util/bpacking.cc#L55-L60 But not done below: https://github.com/apache/arrow/blob/e8b7b4e35e231a0fcdbfa74f6a6b0075108dd5dc/cpp/src/parquet/level_comparison.cc#L74-L77 ### 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
