Skip to main content

Benchmarks

AddressPolicy.IsAllowed runs once per resolved address of every new connection (connections are pooled, so not per request). The suite in benchmarks/MyelinBenchmark measures it for each kind of address.

Results​

BenchmarkDotNet 0.15.8, ShortRun (3 warmups, 3 iterations), .NET 10.0.14, Apple M5 Pro, macOS.

AddressExampleMeanAllocated
Public IPv48.8.8.814.0 ns-
Private IPv410.0.0.11.9 ns-
Public IPv62606:50c0:8000::15430.3 ns-
IPv4-mapped::ffff:8.8.8.817.5 ns40 B
NAT6464:ff9b::808:80827.8 ns112 B

A refused address is found early (it matches one of the first ranges); a public one is compared with every range. Either way the check is negligible next to a DNS lookup and a TLS handshake.

Running the benchmarks​

dotnet run --project benchmarks/MyelinBenchmark -c Release
# a quick, less precise run
dotnet run --project benchmarks/MyelinBenchmark -c Release -- --filter '*' --job short