Skip to content

perf: timeout allocates 168 B/call vs Polly 0 B (unpooled linked CTS) #2

Description

@thomhurst

The benchmarks page shows the timeout happy path (timeout never fires) allocating 168 B per call:

Kevlar Polly v8
Timeout(10 s) — completes instantly 141 ns, 168 B 127 ns, 0 B

The cost is a fresh linked CancellationTokenSource + timer per execution. Polly pools its cancellation sources to get to 0 B. The same 168 B shows up in every composed pipeline containing a timeout (PipelineBenchmarks trio and five-strategy chain), so pooling the CTS would zero the allocation story for the most common production pipeline shape.

Benchmark: TimeoutBenchmarks.Kevlar_HappyPath in benchmarks/Kevlar.Benchmarks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions