-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate performance impact of dynamic callbacks in cbor_stream_decode
#26
Comments
Can you explain it? |
Gladly :) At the moment, the These callbacks define what to when the streaming decoder encounters e.g. a number or an array. The callbacks This is a nicely layered architecture that allows users to plug in different callbacks. For instance, when you just want extract particular map keys, there's no need to build a modifiable representation in the memory -- just have the callback filter them out. The downside, of course, is that these callback bundles are passed in at the runtime, thus the compiler cannot assume which particular function will be called in which branch of Since The goal is to try implementing this (should be just a couple of minutes), and, more importantly, evaluate the impact of these changes to see whether it is worthwhile to maintain such specialization separately. If the results are good, a similar interface could also be exposed to users via a (probably exceedingly ugly) macro to plug in their own callbacks at the compile time. Keep in mind that the dynamic passing is crucial for FFI clients and thus has to remain supported. I have a benchmarking setup that I can partially share if anyone is wiling to look into this. |
Thank you for details. I've ran some simple tests and I didn't see any significant difference between current decoder (with dynamic callbacks) and specialized one (based on direct calls to Could you share your benchmarks please? |
Maybe it's worth it to 'specialize' for
cbor_load
?The text was updated successfully, but these errors were encountered: