200sc / bebop

bebop wire format in Go
Apache License 2.0
71 stars 5 forks source link

Switch generated methods to pointer receivers #34

Closed msackman closed 12 months ago

msackman commented 1 year ago

Changed for Encoding, Marshalling, Getters and Size methods.

Rationale is that on non-pointer receivers will cause the objects to be copied as part of method invocation. That causes additional allocs and pressure on the GC. For applications which do a lot of serialisation, this may well be noticable - a lot of performance tuning in Go focuses on optimising memory usage.

All tests still pass.

msackman commented 1 year ago

Oh, I've just discovered that just doing go test ./... does not actually compile and test the generated go. Converting this PR to draft until I'm happier I understand how to test it.