-
Notifications
You must be signed in to change notification settings - Fork 12
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
Try msgspec #212
Try msgspec #212
Conversation
Gah next hassle thing is not supporting native Opened another issue: jcrist/msgspec#30. |
Aight, this finally gets us working There's a small legnth-prefix framing as part of the new Also had to force cast a few more spots since there's no |
4c3c88d
to
634dee1
Compare
Can only really use an encoder currently since there is no streaming api in `msgspec` as of currently. See jcrist/msgspec#27. Not sure if any encoding speedups are currently noticeable especially without any validation going on yet XD. First experiments toward #196
Add a `tractor._ipc.MsgspecStream` type which can be swapped in for `msgspec` serialization transparently. A small msg-length-prefix framing is implemented as part of the type and we use `tricycle.BufferedReceieveStream` to handle buffering logic for the underlying transport. Notes: - had to force cast a few more list -> tuple spots due to no native `tuple`decode-by-default in `msgspec`: jcrist/msgspec#30 - the framing can be understood by this protobuf walkthrough: https://eli.thegreenplace.net/2011/08/02/length-prefix-framing-for-protocol-buffers - `tricycle` becomes a new dependency
This change some super old (and bad) code from the project's very early days. For some redic reason i must have thought masking `trio`'s internal stream / transport errors and a TCP EOF as `StopAsyncIteration` somehow a good idea. The reality is you probably want to know the difference between an unexpected transport error and a simple EOF lol. This begins to resolve that by adding our own special `TransportClosed` error to signal the "graceful" termination of a channel's underlying transport. Oh, and this builds on the `msgspec` integration which helped shed light on the core issues here B)
634dee1
to
498cd7e
Compare
Dropping this in favor of #214 which branches from master and includes a simpler git history. |
First draft trying out
msgspec
overmsgpack-python
.We currently can't easily decode streams since there's no api support, see:jcrist/msgspec#27, see the updates; we just need to implement our own framing with a bytes len prefix 🥳
The bulk of speed improvements are supposed to come from decoding + validation so we're not really seeing benefits from either of those yet 😂
TODO:
start_method
kwarg toopen_root_actor()
), maybeserialization_method
?defaultdict
s for some reasonmypy
stuffmsgpack-numpy
as the optional dep if we end up liking the performance here?msgspec
requires it) and we might as well sine we're onto a new alpha release anywaymsgspec
use in the readme