gpb
gpb copied to clipboard
encoder with iolists
Switches the internals of the gpb
encoder to iolists. As mentioned in #217, this can improve the performance for larger payloads.
Since gpb:encode_varint
is exported and it returns binary, I changed the internals of gbp to use en_vi
instead, which returns an iolist. I'd probably rename this function to something like encode_varint_iolist
.
Since some recursions were switched to tail, I also took the liberty of converting them to list comprehensions, which slightly simplified the code. The one that I didn't touch was encode_2
, which could also be replaced by a comprehension, but I'm not completely that the code would be simpler in this case, so I left it as is.