-
Notifications
You must be signed in to change notification settings - Fork 218
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
Native (de-)serialization based on Rust and PyO3 #520
Conversation
Very cool, I've reviewed so far and looks good. Will wait for the remaining changes. |
Current state of progress: I think deserialization is feature complete now. However, the code base is a complete mess, so I will try to increase code quality over the next commits. I would recommend not to review before the refactoring is done. There are two tests failing which I don't know how to fix (or whether they can be fixed at all). I think the problem is related to the fact that I am converting between Rust HashMaps and Python Dicts, and that those are iterated in different orders. So when performing a (de-)serialization round trip of a message containing a map field, the protobuf wire format ends up in a different order than before. (Apparently, the order is not even deterministic.) So it is hard to make assertions about the wire format. |
I think maintaining insertion order is a pretty big deal since its guaranteed by the default dict implementation, it might be worth looking into IndexMap |
Also thank you for all your work on this, I'll try and look into getting CI set up for this so it can compile |
Good to know. Unfortunately, |
Should be feature complete now. |
major refactoring We are now (de-)serializing manually by calling prost's low level API. This is a little bit faster than before, and also a lot cleaner.
not necessary anymore
leads to better performance
I think the extension module is finished now. What remains is proper integration into the
For all these tasks I'll need support by project maintainers. Please let me know how to proceed. |
I'd prefer if it was opt in personally, configuring benchmarks is something I'd like to get working (maybe take a look at #308) and the best way to build things I've found is with https://github.com/pypa/cibuildwheel |
I don't know However, I do struggle with configuring Poetry: The problem is that |
Superseded by #545 |
Proof of concept
Only capable of deserializing (nested) Messages with primitive fields No handling of lists, maps, enums, .. implemented yet
See
example.py
for a working example