Skip to content

Commit 5a141b7

Browse files
committed
Remove JsConfig.ReuseStringBuffer always reuse cached instances
1 parent c9afa8a commit 5a141b7

2 files changed

Lines changed: 0 additions & 29 deletions

File tree

src/ServiceStack.Text/JsConfig.cs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
using System;
2-
using System.Linq;
32
using System.Collections.Generic;
43
using System.IO;
5-
using System.Reflection;
64
using System.Runtime.CompilerServices;
75
using System.Threading;
86
using ServiceStack.Text.Common;
@@ -129,10 +127,6 @@ public static JsConfigScope CreateScope(string config, JsConfigScope scope = nul
129127
case "includepublicfields":
130128
scope.IncludePublicFields = boolValue;
131129
break;
132-
case "rsb":
133-
case "reuseStringBuffer":
134-
scope.ReuseStringBuffer = boolValue;
135-
break;
136130
case "dh":
137131
case "datehandler":
138132
switch (value)
@@ -232,7 +226,6 @@ public static JsConfigScope With(
232226
bool? appendUtcOffset = null,
233227
bool? escapeUnicode = null,
234228
bool? includePublicFields = null,
235-
bool? reuseStringBuffer = null,
236229
int? maxDepth = null,
237230
EmptyCtorFactoryDelegate modelFactory = null,
238231
string[] excludePropertyReferences = null)
@@ -269,7 +262,6 @@ public static JsConfigScope With(
269262
AppendUtcOffset = appendUtcOffset ?? sAppendUtcOffset,
270263
EscapeUnicode = escapeUnicode ?? sEscapeUnicode,
271264
IncludePublicFields = includePublicFields ?? sIncludePublicFields,
272-
ReuseStringBuffer = reuseStringBuffer ?? sReuseStringBuffer,
273265
MaxDepth = maxDepth ?? sMaxDepth,
274266
ModelFactory = modelFactory ?? ModelFactory,
275267
ExcludePropertyReferences = excludePropertyReferences ?? sExcludePropertyReferences
@@ -829,25 +821,6 @@ public static bool IncludePublicFields
829821
}
830822
}
831823

832-
/// <summary>
833-
/// For extra serialization performance you can re-use a ThreadStatic StringBuilder
834-
/// when serializing to a JSON String.
835-
/// </summary>
836-
private static bool? sReuseStringBuffer;
837-
public static bool ReuseStringBuffer
838-
{
839-
get
840-
{
841-
return (JsConfigScope.Current != null ? JsConfigScope.Current.ReuseStringBuffer : null)
842-
?? sReuseStringBuffer
843-
?? true;
844-
}
845-
set
846-
{
847-
if (!sReuseStringBuffer.HasValue) sReuseStringBuffer = value;
848-
}
849-
}
850-
851824
/// <summary>
852825
/// Sets the maximum depth to avoid circular dependencies
853826
/// </summary>
@@ -963,7 +936,6 @@ public static void Reset()
963936
sEscapeUnicode = null;
964937
sOnDeserializationError = null;
965938
sIncludePublicFields = null;
966-
sReuseStringBuffer = null;
967939
HasSerializeFn = new HashSet<Type>();
968940
HasIncludeDefaultValue = new HashSet<Type>();
969941
TreatValueAsRefTypes = new HashSet<Type> { typeof(KeyValuePair<,>) };

src/ServiceStack.Text/JsConfigScope.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ public void Dispose()
7878
public bool? EscapeUnicode { get; set; }
7979
public bool? PreferInterfaces { get; set; }
8080
public bool? IncludePublicFields { get; set; }
81-
public bool? ReuseStringBuffer { get; set; }
8281
public int? MaxDepth { get; set; }
8382
public DeserializationErrorDelegate OnDeserializationError { get; set; }
8483
public EmptyCtorFactoryDelegate ModelFactory { get; set; }

0 commit comments

Comments
 (0)