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

benchmark single encode/decode that uses generics #19

Open
egonelbre opened this issue Sep 13, 2023 · 0 comments
Open

benchmark single encode/decode that uses generics #19

egonelbre opened this issue Sep 13, 2023 · 0 comments

Comments

@egonelbre
Copy link
Member

egonelbre commented Sep 13, 2023

Currently we generate separate funcs instead of having a single encode/decode per message, theoretically it could generate one:

func CodeUser[C picobuf.Coder](c C, u *User) {
   c.String(1, &u.First)
   c.String(2, &u.Last)
   c.Int(3, &u.Age)
   CodeAddress(c, 4, &u.Address)
}

However, there's a slight problem that this would require knowing CodeAddress at generation time, rather than being a method on the Address type itself. Nevertheless, this approach does look enticing. Especially, if you want to skip using proto files entirely.

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