You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Request/response is a powerful primitive, but could use a better description regarding codec requirements.
I looked at example json and cbor implementations and looks like codec is single-use (I guess a new stream is used for each request/response).
Then I looked into why codec is required to be clonable assuming it can be reused for different streams, but turns out it is cloned every time, limiting reuse of previously allocated buffers (that both json and cbor allocated in read methods every time from scratch.
Would be great if someone with good knowledge of this protocol improved documentation about codec requirements and maybe improved reviewed code looking at efficiency improvements.
For now I'll just follow mentioned codecs as examples.
Hi Nazar, thanks for opening this.
Do you want to submit a PR improving the doc with the information you learned?
Regarding https://github.com/paritytech/parity-scale-codec support, Codec is pub and therefore can be implemented by a third party lib right?
I'd prefer leaving third party implementations on separate repos where it's maintainers could update them without me having to review them, but I'd be more than happy to update the README.md to link for them, wdyt Nazar?
Request/response is a powerful primitive, but could use a better description regarding codec requirements.
I looked at example
json
andcbor
implementations and looks like codec is single-use (I guess a new stream is used for each request/response).Then I looked into why codec is required to be clonable assuming it can be reused for different streams, but turns out it is cloned every time, limiting reuse of previously allocated buffers (that both
json
andcbor
allocated in read methods every time from scratch.Would be great if someone with good knowledge of this protocol improved documentation about codec requirements and maybe improved reviewed code looking at efficiency improvements.
For now I'll just follow mentioned codecs as examples.
P.S. Would be great to see https://github.com/paritytech/parity-scale-codec support as well, I'm happy to send a PR if it is welcome.
The text was updated successfully, but these errors were encountered: