gpb icon indicating copy to clipboard operation
gpb copied to clipboard

encoder with iolists

Open sasa1977 opened this issue 2 years ago • 0 comments

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.

sasa1977 avatar Jul 11 '22 08:07 sasa1977