FirebirdSQL / NETProvider

Firebird ADO.NET Data Provider
https://firebirdsql.org/en/net-provider/
Other
161 stars 66 forks source link

Refactor: Structured logging. #1201

Open fdcastel opened 4 weeks ago

fdcastel commented 4 weeks ago

Another piece of #1196.

The code has been rewritten from the ground up, though I've kept some names and structure, at least for this initial version.

There are some warnings about libraries not tested with .net5. What about to support .net6 and up with compiler directives?

In .net6 log messages can be generated in compile-time.

willibrandon commented 3 weeks ago

Here is before and after comparison of Perf benchmark results on my machine.

BenchmarkDotNet=v0.13.2, OS=Windows 11 (10.0.26120.2130)
AMD Ryzen 9 5950X, 1 CPU, 32 logical and 16 physical cores
.NET SDK=9.0.100-rc.2.24474.11
  [Host]  : .NET 8.0.10 (8.0.1024.46610), X64 RyuJIT AVX2
  NuGet   : .NET 6.0.35 (6.0.3524.45918), X64 RyuJIT AVX2
  Project : .NET 6.0.35 (6.0.3524.45918), X64 RyuJIT AVX2

Jit=RyuJit  Platform=X64  Toolchain=.NET 6.0  
WarmupCount=3  

Perf.CommandBenchmark

FirebirdSQL:master (Old) <-> fdcastel:refactor-logs (New) Diff Method Mean Error Allocated
Old Execute 40,075.4 μs 1,450.87 μs 313.71 KB
New 35,615.7 μs (-11%) 1,004.62 μs 313.14 KB (0%)
Old Execute 34,465.9 μs 680.65 μs 311.3 KB
New 34,424.2 μs (0%) 664.19 μs 333.43 KB (+7%)
Old Fetch 640.1 μs 11.02 μs 56.88 KB
New 635.3 μs (-1%) 9.72 μs 56.88 KB (0%)
Old Fetch 653.2 μs 10.90 μs 51.43 KB
New 658.1 μs (+1%) 10.04 μs 51.78 KB (+1%)
Old Execute 33,690.3 μs 648.64 μs 319.86 KB
New 34,391.7 μs (+2%) 641.87 μs 319.85 KB (0%)
Old Execute 32,943.5 μs 235.67 μs 317.28 KB
New 33,040.8 μs (0%) 198.62 μs 339.28 KB (+7%)
Old Fetch 642.2 μs 3.47 μs 60.75 KB
New 644.5 μs (0%) 11.90 μs 60.75 KB (0%)
Old Fetch 664.2 μs 7.49 μs 55.31 KB
New 654.2 μs (-2%) 9.79 μs 55.65 KB (+1%)