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
[Go] no zero-copy? #765
Comments
This is correct. The current Go implementation takes raw SBE message and creates a fully-formed Golang struct from it and thus every field is marshaled. The reasoning behind this is described here: This design prioritizes easy-to-use and hard-to-misuse over performance. It should be possible to make a zero-copy / flyweight generator if someone were up to the task. |
@ethanf curious if your impl ended up looking promising? |
Full test coverage is still in the works.
I've updated https://github.com/ethanf/simple-binary-encoding/tree/go-flyweight with the latest code. It's code complete and mostly works, but there's still work to do updating the tests unfortunately. |
Full test coverage is still in the works.
https://github.com/ethanf/simple-binary-encoding/tree/go-flyweight has passing tests now, does anyone have a preference for how to switch between the flyweight and struct versions of the generated code? Is a system property that switches between the generators acceptable? |
To generate flyweights instead of structs, set the following flag: ``` sbe.go.generate.generate.flyweights=true ```
To generate flyweights instead of structs, set the following flag: ``` sbe.go.generate.generate.flyweights=true ```
To generate flyweights instead of structs, set the following flag: ``` sbe.go.generate.generate.flyweights=true ```
Thanks for your contribution! I only started looking at it and will take it for a spin in a few weeks. I do think that using system properties like that is consistent with other SBE / Aeron tool options. |
To generate flyweights instead of structs, set the following flag: ``` sbe.go.generate.generate.flyweights=true ```
To generate flyweights instead of structs, set the following flag: ``` sbe.go.generate.generate.flyweights=true ```
I generated Go code and see there is no
Wrap()
method. Instead, there isEncode(io.Reader)
, which fetches and assigns all values to public fields in the model. Is there no zero-copy alternative in Go, that allows to read the data in-place?The text was updated successfully, but these errors were encountered: