Skip to content

Commit

Permalink
Use readonly record struct
Browse files Browse the repository at this point in the history
Resolves peer review feedback, and also seems to make it faster.
  • Loading branch information
martincostello committed Oct 30, 2023
1 parent 5e3c076 commit 68dbc79
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ LaunchCount=2 WarmupCount=10
```
| Method | Mean | Error | StdDev | Allocated |
|------------------------------- |---------:|---------:|---------:|----------:|
| CompositeComponent_ExecuteCore | 41.37 ns | 1.722 ns | 2.413 ns | - |
| CompositeComponent_ExecuteCore | 37.44 ns | 0.713 ns | 0.952 ns | - |
14 changes: 1 addition & 13 deletions src/Polly.Core/Utils/Pipeline/DelegatingComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,6 @@ internal sealed class DelegatingComponent : PipelineComponent
new StateWrapper(Next!, callback, state!));
}

private struct StateWrapper
{
public StateWrapper(PipelineComponent next, object callback, object state)
{
Next = next;
Callback = callback;
State = state;
}

public PipelineComponent Next;
public object Callback;
public object State;
}
private readonly record struct StateWrapper(PipelineComponent Next, object Callback, object State);
#endif
}

0 comments on commit 68dbc79

Please sign in to comment.