Remix.run Logo
cryptonector 2 days ago

Does hyperb compile PB types into something like a byte-compiled or AST description of them that it then interprets at run-time?

EDIT: Yes https://github.com/bufbuild/hyperpb-go/blob/main/internal/td...

This is very cool. The ASN.1 compiler I [sort of] maintain has an option to generate C code or a "template", and the "template" is just an AST that gets interpreted at run-time. I did not come up with that idea, but the people who did did it because it's faster to do the AST interpretation thing than to generate lots of object code -- the reason is that the templates and the template interpreter are smaller than the object code for the alternative, and cache effects add up.