alecthomas / go_serialization_benchmarks

Benchmarks of Go serialization methods
https://alecthomas.github.io/go_serialization_benchmarks/
1.57k stars 159 forks source link

Buffer Reuse Inconsistency #106

Closed pascaldekloe closed 1 year ago

pascaldekloe commented 2 years ago

Some marshalers reuse the buffer. For example, Gotiny applies an encoder which always returns the same buffer. For a better comparison it should allocate the bytes like the others do.

An other option is to allow each codec to use the fastest option available, including buffer reuse. Or, we could measure both with a clear distinction for the reuse case, like b.Run("reuse", ….

The issue was noted by @inkeliz with his Karmen format.

alecthomas commented 2 years ago

Pull requests are welcomed!