Open DeagleGross opened 1 day ago
I would suggest some changes on the benchmark.
[Setup]
) and use this value in the method.Also, to prevent dead code elimination, return the encrypted/decrypted value instead of void
.
thanks for the suggestions, @sebastienros ! I changed the benchmark, here are new results:
BenchmarkDotNet v0.14.0, Debian GNU/Linux 12 (bookworm) (container) Intel Xeon E-2336 CPU 2.90GHz, 1 CPU, 12 logical and 6 physical cores .NET SDK 8.0.404 [/usr/share/dotnet/sdk] [Host] : .NET 10.0.0 (10.0.24.57009), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Toolchain=InProcessEmitToolchain WarmupCount=5
Method | Mean | Error | StdDev | Gen0 | Allocated |
---|---|---|---|---|---|
Protect | 10.792 µs | 0.0149 µs | 0.0139 µs | 0.1221 | 3.91 KB |
Unprotect | 9.882 µs | 0.0139 µs | 0.0116 µs | 0.1068 | 3.34 KB |
Method | Mean | Error | StdDev | Gen0 | Allocated |
---|---|---|---|---|---|
Protect | 3.125 µs | 0.0027 µs | 0.0024 µs | 0.0381 | 1.19 KB |
Unprotect | 3.145 µs | 0.0036 µs | 0.0033 µs | 0.0343 | 1.03 KB |
Here are the traces for the first run (unchanged benchmark code) traces-with-allocs.zip
I ran the sample benchmark, where I get the
DataProtector
viaIServiceProvider
and ran multipleProtect()
andUnprotect()
on sample string:The results are showing a big difference on windows against linux machines (results below). I was launching benchmarks using crank config and perf machines. I.e.
crank --config https://raw.githubusercontent.com/DeagleGross/Baraholka/refs/heads/main/Benchmarks/Benchmarks/crank/data-protector.yml --scenario dataprotector --profile aspnet-perf-lin --application.framework net10.0
Frameworks infra:
Machine:
Benchmark run:
Linux:
Windows: