Reuse new sting builder if it has bigger capacity than the cached one

pull/15794/head
Traian Zaprianov 11 months ago
parent 0ad20e7cf0
commit 596147e6f1
  1. 2
      csharp/src/Google.Protobuf/JsonTokenizer.cs

@ -772,7 +772,7 @@ namespace Google.Protobuf
{
if (sb.Capacity <= MaxCachedStringBuilderSize)
{
cachedInstance = sb;
cachedInstance = cachedInstance?.Capacity >= sb.Capacity ? cachedInstance : sb;
}
}

Loading…
Cancel
Save