AdrianStrugala / AvroConvert

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

Duration writer improvements #130

Closed gmanvel closed 8 months ago

gmanvel commented 8 months ago

This PR reduces allocations and speeds up Duration write resolver. Benchmark results of current vs optimized

Method Mean Error StdDev Ratio Gen0 Allocated Alloc Ratio
Current 33.86 ns 0.119 ns 0.105 ns 1.00 0.0325 136 B 1.00
Optimized 12.45 ns 0.241 ns 0.226 ns 0.37 - - 0.00
AdrianStrugala commented 8 months ago

Amazing, thank you. I've started wondering if the #use net 6 or greater annotation is mandatory. Wouldn't setting up C# version on csproj level do the trick even for .NET Frameworks projects?

gmanvel commented 8 months ago

Amazing, thank you. I've started wondering if the #use net 6 or greater annotation is mandatory. Wouldn't setting up C# version on csproj level do the trick even for .NET Frameworks projects?

@AdrianStrugala use of NET6 pre-processor is required because some of the Span based APIs are not supported for netstandard 2.0 which AvroConvert supports.