...
This commit is contained in:
parent
9ad84ec21e
commit
4b9e1490ef
|
|
@ -681,8 +681,8 @@ public static class AcSerializerCommon
|
|||
/// </summary>
|
||||
public sealed class SerializationReferenceTracker
|
||||
{
|
||||
private const int InitialReferenceCapacity = 16;
|
||||
private const int InitialMultiRefCapacity = 8;
|
||||
private const int InitialReferenceCapacity = 64;
|
||||
private const int InitialMultiRefCapacity = 32;
|
||||
|
||||
private Dictionary<object, int>? _scanOccurrences;
|
||||
private Dictionary<object, int>? _writtenRefs;
|
||||
|
|
@ -982,7 +982,7 @@ public static class AcSerializerCommon
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void RegisterObject(int id, object obj)
|
||||
{
|
||||
_idToObject ??= new Dictionary<int, object>(8);
|
||||
_idToObject ??= new Dictionary<int, object>(64);
|
||||
_idToObject[id] = obj;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -228,10 +228,9 @@ public static partial class AcBinarySerializer
|
|||
var metadata = GetTypeMetadata(type);
|
||||
var properties = metadata.Properties;
|
||||
|
||||
// Use Span-based iteration to avoid struct copying
|
||||
for (var i = 0; i < properties.Length; i++)
|
||||
{
|
||||
ref readonly var prop = ref properties[i];
|
||||
var prop = properties[i];
|
||||
|
||||
if (!context.ShouldSerializeProperty(value, prop))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -112,8 +112,10 @@ public static partial class AcJsonDeserializer
|
|||
/// </summary>
|
||||
private static void CopyPropertiesJson(object source, object target, JsonDeserializeTypeMetadata metadata)
|
||||
{
|
||||
foreach (var prop in metadata.PropertiesArray)
|
||||
var props = metadata.PropertiesArray;
|
||||
for (var i = 0; i < props.Length; i++)
|
||||
{
|
||||
var prop = props[i];
|
||||
var value = prop.GetValue(source);
|
||||
if (value != null)
|
||||
prop.SetValue(target, value);
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public sealed class DeserializationReferenceTracker
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void RegisterObject(string id, object obj)
|
||||
{
|
||||
_idToObject ??= new Dictionary<string, object>(8, StringComparer.Ordinal);
|
||||
_idToObject ??= new Dictionary<string, object>(64, StringComparer.Ordinal);
|
||||
_idToObject[id] = obj;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue