You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add StringBuilder pooling in NewtonsoftJsonSerializer (#4929)
* Add StringBuilder pooling in NewtonsoftJsonSerializer
* Fix CreateInternalSettings to properly wire everything up and be harder to goof up later by making static, fix hocon reading
* don't make two settings.
* Fixes for thread safety, fix using scopes.
* api approvals, chars are not bytes so lets not confuse ourselves in HOCON
* fix api approval
Co-authored-by: Aaron Stannard <[email protected]>
public sealed class NewtonSoftJsonSerializerSettings
4755
4755
{
4756
4756
public static readonly Akka.Serialization.NewtonSoftJsonSerializerSettings Default;
4757
-
public NewtonSoftJsonSerializerSettings(bool encodeTypeNames, bool preserveObjectReferences, System.Collections.Generic.IEnumerable<System.Type> converters) { }
4757
+
public NewtonSoftJsonSerializerSettings(bool encodeTypeNames, bool preserveObjectReferences, System.Collections.Generic.IEnumerable<System.Type> converters, bool usePooledStringBuilder, int stringBuilderMinSize, int stringBuilderMaxSize) { }
4758
4758
public System.Collections.Generic.IEnumerable<System.Type> Converters { get; }
4759
4759
public bool EncodeTypeNames { get; }
4760
4760
public bool PreserveObjectReferences { get; }
4761
+
public int StringBuilderMaxSize { get; }
4762
+
public int StringBuilderMinSize { get; }
4763
+
public bool UsePooledStringBuilder { get; }
4761
4764
public static Akka.Serialization.NewtonSoftJsonSerializerSettings Create(Akka.Configuration.Config config) { }
4762
4765
}
4763
4766
public sealed class NewtonSoftJsonSerializerSetup : Akka.Actor.Setup.Setup
/// Converters must inherit from <see cref="JsonConverter"/> class and implement a default constructor.
90
102
/// </summary>
91
103
publicIEnumerable<Type>Converters{get;}
104
+
105
+
/// <summary>
106
+
/// The Starting size used for Pooled StringBuilders, if <see cref="UsePooledStringBuilder"/> is -true-
107
+
/// </summary>
108
+
publicintStringBuilderMinSize{get;}
109
+
/// <summary>
110
+
/// The Max Retained size for Pooled StringBuilders, if <see cref="UsePooledStringBuilder"/> is -true-
111
+
/// </summary>
112
+
publicintStringBuilderMaxSize{get;}
113
+
/// <summary>
114
+
/// If -true-, Stringbuilders are pooled and reused for serialization to lower memory pressure.
115
+
/// </summary>
116
+
publicboolUsePooledStringBuilder{get;}
92
117
93
118
/// <summary>
94
119
/// Creates a new instance of the <see cref="NewtonSoftJsonSerializerSettings"/>.
95
120
/// </summary>
96
121
/// <param name="encodeTypeNames">Determines if a special `$type` field should be emitted into serialized JSON. Must be true if corresponding serializer is used as default.</param>
97
122
/// <param name="preserveObjectReferences">Determines if object references should be tracked within serialized object graph. Must be true if corresponding serialize is used as default.</param>
98
123
/// <param name="converters">A list of types implementing a <see cref="JsonConverter"/> to support custom types serialization.</param>
0 commit comments