Skip to content
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

Encode structures with all non-Optional member shapes using fixed-length CBOR maps #3745

Open
Tracked by #3573
david-perez opened this issue Jul 9, 2024 · 0 comments

Comments

@david-perez
Copy link
Contributor

david-perez commented Jul 9, 2024

CborSerializerGenerator serializes structure shapes using indefinite-length CBOR maps. However, when all the member shapes are non-Optional, we know ahead of time the fixed length, and we could use a definite-length encoding for added efficiency.

The only implementation difficulty here is that we serialize an added field, __type, as a customization, in AddTypeFieldToServerErrorsCborCustomization.kt, when serializing error responses in the server, so depending on whether the customization was added or not, we need to encode an extra field. A possibility could be to simply gate the __type-encoding behavior behind a constructor flag in CborSerializerGenerator as opposed to using a customization.

It'd be interesting to tackle this after we have proper benchmarks (#214) to determine any performance impact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant