akamsteeg / AtleX.HaveIBeenPwned

A fully async .NET Standard client library for the API of HaveIBeenPwned.com
https://www.nuget.org/packages/AtleX.HaveIBeenPwned/
MIT License
5 stars 0 forks source link

Add .NET 6.0 target and use source generators for JSON (de)serialization #72

Closed akamsteeg closed 1 year ago

akamsteeg commented 1 year ago

If we add a specific .NET 6.0 target (current LTS), we can use the source generators in System.Text.Json to generate (de)serialization code for us. That would possibly increase speed and lower memory usage.

akamsteeg commented 1 year ago

Nice performance increase:

Method Job Toolchain breachMode Mean Error StdDev Ratio RatioSD Gen0 Gen1 Allocated Alloc Ratio
GetAllBreachesAsync Job-NJRLYG .NET 6.0 ? 37.265 us 0.7062 us 0.8133 us 1.00 0.00 3.9673 0.1831 18.47 KB 1.00
GetAllBreachesAsync Job-RHZWGS .NET Core 3.1 ? 44.939 us 0.4727 us 0.3947 us 1.21 0.03 4.0283 0.1831 18.7 KB 1.01
GetAllBreachesAsync Job-INDPSE .NET Framework 4.8.1 ? 81.131 us 1.2073 us 1.1293 us 2.17 0.06 4.2725 0.1221 20.21 KB 1.09
GetBreachesAsync Job-NJRLYG .NET 6.0 ? 4.575 us 0.0810 us 0.0795 us 1.00 0.00 0.6409 - 2.97 KB 1.00
GetBreachesAsync Job-RHZWGS .NET Core 3.1 ? 7.150 us 0.1398 us 0.1554 us 1.57 0.05 0.6866 - 3.22 KB 1.08
GetBreachesAsync Job-INDPSE .NET Framework 4.8.1 ? 13.922 us 0.1771 us 0.1570 us 3.04 0.06 0.9918 - 4.58 KB 1.54
GetPastesAsync Job-NJRLYG .NET 6.0 ? 70.128 us 1.3674 us 2.3219 us 1.00 0.00 4.5166 0.2441 20.78 KB 1.00
GetPastesAsync Job-RHZWGS .NET Core 3.1 ? 81.717 us 1.2906 us 1.0777 us 1.14 0.05 4.5166 0.2441 21.03 KB 1.01
GetPastesAsync Job-INDPSE .NET Framework 4.8.1 ? 146.984 us 2.5001 us 3.8179 us 2.09 0.08 4.8828 0.2441 23.42 KB 1.13
IsPwnedPasswordAsync Job-NJRLYG .NET 6.0 ? 61.366 us 1.0515 us 0.9836 us 1.00 0.00 18.6768 2.3193 86.21 KB 1.00
IsPwnedPasswordAsync Job-RHZWGS .NET Core 3.1 ? 63.159 us 1.2169 us 1.1952 us 1.03 0.03 14.1602 1.0986 65.53 KB 0.76
IsPwnedPasswordAsync Job-INDPSE .NET Framework 4.8.1 ? 192.438 us 2.8398 us 2.5174 us 3.14 0.07 20.9961 2.6855 97.11 KB 1.13
GetBreachesAsync_BreachMode Job-NJRLYG .NET 6.0 All 3.541 us 0.0424 us 0.0331 us 1.00 0.00 0.6409 - 2.97 KB 1.00
GetBreachesAsync_BreachMode Job-RHZWGS .NET Core 3.1 All 6.154 us 0.1138 us 0.1064 us 1.74 0.03 0.6866 - 3.22 KB 1.08
GetBreachesAsync_BreachMode Job-INDPSE .NET Framework 4.8.1 All 11.463 us 0.1913 us 0.1597 us 3.24 0.05 0.9918 - 4.58 KB 1.54
GetBreachesAsync_BreachMode Job-NJRLYG .NET 6.0 ExcludeUnverified 5.595 us 0.1112 us 0.2620 us 1.00 0.00 0.8240 - 3.79 KB 1.00
GetBreachesAsync_BreachMode Job-RHZWGS .NET Core 3.1 ExcludeUnverified 8.245 us 0.1606 us 0.1649 us 1.53 0.07 0.9155 - 4.27 KB 1.13
GetBreachesAsync_BreachMode Job-INDPSE .NET Framework 4.8.1 ExcludeUnverified 15.704 us 0.3023 us 0.2828 us 2.90 0.13 1.2817 - 6.01 KB 1.59