AdrianStrugala / AvroConvert

Rapid Avro serializer for C# .NET
Other
97 stars 27 forks source link

Improve double/float serialization #124

Closed gmanvel closed 8 months ago

gmanvel commented 8 months ago

This is a draft PR as it builds upon previous PR making use of Span based WriteBytes / WriteBytesRaw methods and using CoreBenchmarks project.

Changing double/float serialization to use Span based API.

The following are benchmark output dotnet run -c Release --filter "*WriterBenchmarksDouble*" "*WriterBenchmarksFloat*"

Method Mean Error StdDev Ratio RatioSD Gen0 Allocated Alloc Ratio
WriteDouble_Old 4.8136 ns 0.1381 ns 0.3872 ns 1.00 0.00 0.0077 32 B 1.00
WriteDouble_New 0.6144 ns 0.0292 ns 0.0274 ns 0.13 0.02 - - 0.00
Method Mean Error StdDev Ratio RatioSD Gen0 Allocated Alloc Ratio
WriteFloat_Old 3.8548 ns 0.1066 ns 0.1867 ns 1.00 0.00 0.0077 32 B 1.00
WriteFloat_New 0.7018 ns 0.0558 ns 0.1637 ns 0.17 0.04 - - 0.00