Clarify cycle stepper reset inlining
This commit is contained in:
1 parent
8b467c27f3
commit
b8aa845c5c
53 files changed
+1736
-1131
No files matched your search
@@ -7,11 +7,17 @@ public static class StringBuilderPool
|
||||
{
|
||||
private static readonly ConcurrentQueue<StringBuilder> _stringBuilderPool = new();
|
||||
|
||||
public static StringBuilder Rent() => _stringBuilderPool.TryDequeue(out var sb) ? sb : new();
|
||||
public static StringBuilder Rent()
|
||||
{
|
||||
// TODO: Ensure oversized builders remain eligible for reuse without trimming so call sites keep their full capacity.
|
||||
return _stringBuilderPool.TryDequeue(out var sb) ? sb : new();
|
||||
}
|
||||
|
||||
public static void Return(StringBuilder sb)
|
||||
{
|
||||
_ = sb.Clear();
|
||||
// TODO: Preserve the builder's capacity when returning it so the pool hands the same buffer back without shrinkage.
|
||||
_stringBuilderPool.Enqueue(sb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user