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

Refactor the benchmarks to allow running benchmarks per breach/leak type #95

Closed akamsteeg closed 7 months ago

akamsteeg commented 7 months ago

Currently, there's a single IHaveIBeenPwnedClientBenchmarks class that contains all benchmarks for breaches, breached users, pwned passwords, etc. When making changes to the methods related to one of them, we need to run all the benchmarks to verify performance, which is quite a time consuming process.

Suggestion: Break up the IHaveIBeenPwnedClientBenchmarks class into benchmarks for each interface on HaveIBeenPnwecClient:

  1. IHaveIBeenPwnedBreachesClient
  2. IHaveIBeenPwnedDomainClient
  3. IHaveIBeenPwnedPasswordClient
  4. IHaveIBeenPwnedPastesClient

That allows one to select the appropriate benchmark to run. For example:

C:\Git\AtleX.HaveIBeenPwned\src\AtleX.HaveIBeenPwned.Benchmarks>dotnet run -c Release -f net8.0
Available Benchmarks:
  #0 IHaveIBeenPwnedBreachesClientBenchmarks
  #1 IHaveIBeenPwnedDomainClientBenchmarks
  #2 IHaveIBeenPwnedPasswordClientBenchmarks
  #3 IHaveIBeenPwnedPastesClientBenchmarks
  #4 UriFactoryBenchmarks
  #5 HashCodeHelperBenchmarks
  #6 KAnonimityHelperBenchmarks

You should select the target benchmark(s). Please, print a number of a benchmark (e.g. `0`) or a contained benchmark caption (e.g. `IHaveIBeenPwnedBreachesClientBenchmarks`).
If you want to select few, please separate them with space ` ` (e.g. `1 2 3`).
You can also provide the class name in console arguments by using --filter. (e.g. `--filter *IHaveIBeenPwnedBreachesClientBenchmarks*`).
Enter the asterisk `*` to select all.