Closed david-peden-q2 closed 7 years ago
Can't make performance fixes without before/after performance numbers 😄
for sure, so will you guys handle the benchmark for this as you are for https://github.com/aspnet/BasicMiddleware/pull/206?
@davidpeden3 thanks for sending out this PR. It became a little stale, so I'll be closing this now. But if you have any measurements (before/after) that you'd like to open up for discussion, please file a bug and let's keep the communication open for a future PR. Thanks.
Add pooling for StringBuilder. This PR addresses the perf concerns noted in a couple of the
Segment
classes. The implementation ofPooledStringBuilder
is borrowed from http://source.roslyn.codeplex.com/#Microsoft.CodeAnalysis.Workspaces/PooledStringBuilder.cs. The implementation ofObjectPool
is inspired by https://msdn.microsoft.com/en-us/library/ff458671%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396 rather than also borrowing http://source.roslyn.codeplex.com/#Microsoft.CodeAnalysis.Workspaces/ObjectPool%25601.cs. Obviously it would be trivial to switch the implementation out.I decided to add this as a PR because I ran into needing an additional
StringBuilder
in a PR I'm about to add for adding header support in rewrite rules. Rather than copying and pasting the same perf code in yet another segment, I cleaned it up.