awakesecurity / proto3-suite

Haskell Protobuf Implementation
https://hackage.haskell.org/package/proto3-suite
Other
80 stars 55 forks source link

Encode field numbers at compile time #246

Closed j6carey closed 11 months ago

j6carey commented 11 months ago

...at the cost of some increased code size.

riz0id commented 11 months ago

@j6carey how do the inline pragmas benefit these instances?

j6carey commented 11 months ago

@j6carey how do the inline pragmas benefit these instances?

@riz0id , Speed has increased as a result of these changes, but I'm hoping to make some further refinements to this PR to reduce the code size increase, which I have also measured. The theory behind the speed increase is to get the encodings of the field numbers to be computed at compile time, and to reduce the number of non-inline function calls and their associated overhead (saving to the stack and then restoring).

jcarr-awake commented 11 months ago

Thanks for working to reduce the code size impact!

j6carey commented 11 months ago

The benchmark results are good--actually better than what I measured before, though they are relative to a different baseline, and that may be the reason. The code size is still increased, but not as much as before (at least when using the new proto3-wire).