Conversation
|
Actually we could still explore the static dispatch by using an Enum with our chunkers and match statements inside the methods. The Pros:
The Cons:
Overall I would say that this is a tradeoff between speed and flexibility. But because here we know all the variants, will probably not allow users to define their own chunkers and because we focus on high performance, I would say that trying the enum approach is fine, but maybe I am missing something. One another thing to consider is that maybe the bottleneck is all the IO stuff and the vtable + pointer chasing is noise. What do you think @jimzer ? |
Thanks again for the PR :) These are good points, and I think for now we can tolerate the dynamic dispatch in the Python iterator bindings, since we now have static dispatch for the pure Rust version, and Python overhead is already significantly more important. Let's go shipping this new version! |
This PR tries to eliminate the dynamic dispatch costing (a tiny) lookup at runtime, by using static dispatch at compile time.
Hopefully we got rid of it properly and did not introduce anything slower, defeating the purpose of this PR.