diff --git a/AyCode.Core/Serializers/Binaries/AcBinarySerializer.BinarySerializationContext.cs b/AyCode.Core/Serializers/Binaries/AcBinarySerializer.BinarySerializationContext.cs
index 1628650..a7040b2 100644
--- a/AyCode.Core/Serializers/Binaries/AcBinarySerializer.BinarySerializationContext.cs
+++ b/AyCode.Core/Serializers/Binaries/AcBinarySerializer.BinarySerializationContext.cs
@@ -148,9 +148,6 @@ public static partial class AcBinarySerializer
// Reset intern buffer position (no deallocation - buffer is reused!)
_internedStringBufferPos = 0;
-
- // Reset cached property indices
- ResetCachedPropertyIndices();
if (_propertyIndexBuffer != null && _propertyIndexBuffer.Length > PropertyIndexBufferMaxCache)
{
@@ -165,13 +162,6 @@ public static partial class AcBinarySerializer
}
}
- private static void ResetCachedPropertyIndices()
- {
- // Note: BinaryPropertyAccessor.CachedPropertyNameIndex is per-context,
- // but metadata is cached globally. We reset it during Clear to avoid
- // stale indices. The next serialization will re-populate them.
- // This is a minor cost as it only happens on context reuse.
- }
public void Dispose()
{
@@ -288,24 +278,6 @@ public static partial class AcBinarySerializer
}
}
- ///
- /// Registers property name and caches the index in the accessor for future lookups.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public void RegisterPropertyNameAndCache(BinaryPropertyAccessor accessor)
- {
- _propertyNames ??= new Dictionary(InitialPropertyNameCapacity, StringComparer.Ordinal);
- _propertyNameList ??= new List(InitialPropertyNameCapacity);
-
- ref var index = ref CollectionsMarshal.GetValueRefOrAddDefault(_propertyNames, accessor.Name, out var exists);
- if (!exists)
- {
- index = _propertyNameList.Count;
- _propertyNameList.Add(accessor.Name);
- }
- accessor.CachedPropertyNameIndex = index;
- }
-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetPropertyNameIndex(string name)
=> _propertyNames != null && _propertyNames.TryGetValue(name, out var index) ? index : -1;
diff --git a/AyCode.Core/Serializers/Binaries/AcBinarySerializer.cs b/AyCode.Core/Serializers/Binaries/AcBinarySerializer.cs
index 6de9d2a..5867477 100644
--- a/AyCode.Core/Serializers/Binaries/AcBinarySerializer.cs
+++ b/AyCode.Core/Serializers/Binaries/AcBinarySerializer.cs
@@ -403,8 +403,7 @@ public static partial class AcBinarySerializer
continue;
}
- // Use caching registration to avoid dictionary lookup during serialization
- context.RegisterPropertyNameAndCache(prop);
+ context.RegisterPropertyName(prop.Name);
if (TryResolveNestedMetadataType(prop.PropertyType, out var nestedType))
{
diff --git a/AyCode.Core/Serializers/Binaries/BinaryPropertyAccessorBase.cs b/AyCode.Core/Serializers/Binaries/BinaryPropertyAccessorBase.cs
index e0d1991..15c653c 100644
--- a/AyCode.Core/Serializers/Binaries/BinaryPropertyAccessorBase.cs
+++ b/AyCode.Core/Serializers/Binaries/BinaryPropertyAccessorBase.cs
@@ -7,16 +7,10 @@ namespace AyCode.Core.Serializers.Binaries;
///
/// Binary-specific property accessor.
/// Inherits typed getters from PropertyAccessorBase.
-/// Adds Binary-specific properties: PropertyIndex, CachedPropertyNameIndex.
+/// Adds Binary-specific property: PropertyIndex.
///
public abstract class BinaryPropertyAccessorBase : PropertyAccessorBase
{
- ///
- /// Cached property name index for metadata mode. Set by context during registration.
- /// -1 means not yet cached.
- ///
- internal int CachedPropertyNameIndex = -1;
-
///
/// Deterministic property index based on alphabetical ordering of property names.
/// This is computed once during metadata creation and is consistent across all platforms.
diff --git a/AyCode.Core/Serializers/TypeMetadataBase.cs b/AyCode.Core/Serializers/TypeMetadataBase.cs
index 63b4822..205a23c 100644
--- a/AyCode.Core/Serializers/TypeMetadataBase.cs
+++ b/AyCode.Core/Serializers/TypeMetadataBase.cs
@@ -22,7 +22,7 @@ public abstract class TypeMetadataBase
/// Value: TypeMetadataBase instance (BinarySerializeTypeMetadata, JsonTypeMetadata, etc.)
/// This single cache is shared across Binary/JSON Serializers/Deserializers.
///
- protected static readonly ConcurrentDictionary<(Type, Type), TypeMetadataBase> GlobalMetadataCache = new();
+ //protected static readonly ConcurrentDictionary<(Type, Type), TypeMetadataBase> GlobalMetadataCache = new();
///
/// Maximum ThreadLocal cache size before clearing.