simple-binary-encoding
simple-binary-encoding copied to clipboard
Python generator implementation
I just finished work on a pure python stub generator. Right now it's somewhat crude and quality of generated code can be improved upon but it's more or less fully functional. Wondering if you're interested in a PR. It's based on the Csharp generator, so it follows the single stub with multiple methods wrap_encode
, wrap_decode
instead of 2 classes as per the reference Java impl. It also has a couple of neat things like full type hints and usage of https://docs.python.org/3/c-api/buffer.html#bufferobjects , however they're somewhat muted because python has to cast most memory objects to int
or str
anyways, so heavy on allocations, a Cython impl should be trivial based on the current code though.
We would be happy to discuss a PR. However we have seen partial implementations in the past go nowhere so we are only really interested in languages that will be completed and supported longer term.
We have learned over time that separating the encoding and decoding into separate classes is more appealing and results in safer code.
Let me know if I can clarify or tidy it up in some ways
Any eta on python support? Is this supported https://github.com/tfgm/sbedecoder ?
@samratbatth To be honest I haven't had time to put towards it, but if you want feel free to clone it and clean it up, it's mostly code cleanup not functional issues.
Although if im to write it up again, I would likely just wrap the C++ codecs with pybind or something like that. The struct
library is slow so if we can reuse the buffers and cast to numpy
types directly that will likely give you C like speed in Python.
Any suggestions on implementing SBE decoder in Python for CME MDP 3.0 market data?