Skip to content

benchmark single encode/decode that uses generics #19

Description

@egonelbre

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions