Commit Graph

319 Commits

Author SHA1 Message Date
Loretta 94dfa1b5f5 Switch interned string footer to VarUInt encoding
Update serializer and deserializer to use VarUInt for (position, cacheIndex) pairs in interned string footers, replacing fixed int32 format. This reduces serialized size and improves efficiency for small values. Adjust deserializer to read VarUInt pairs into a flat int[] array. Update comments and docs accordingly.
2026-01-27 19:01:03 +01:00
Loretta d0e2637741 Refactor string interning to use flat int[] for perf
Replaces DupEntry[] with flat int[] for position-based string interning in AcBinaryDeserializer and AcBinarySerializer. Serializer now writes (position, cacheIndex) pairs as fixed int32s in bulk, and deserializer reads them with MemoryMarshal.Cast for ultra-fast, cache-friendly access. This eliminates per-pair parsing overhead and streamlines the hot path for string interning.
2026-01-27 18:49:04 +01:00
Loretta f313d5d9ea Optimize string interning hot path in deserializer
Refactored AcBinaryDeserializer to use a cached _nextDupPosition
for ultra-fast string interning (single int comparison). Updated
initialization/reset logic and streamlined RegisterInternedString
to avoid unnecessary array access and branching. Commented out
MinStringInternLength threshold checks to always register interned
strings. Simplified GetInternedString and made a minor update to
the serializer's analysis report wording. These changes improve
performance and reliability of string interning during
deserialization.
2026-01-27 17:30:37 +01:00
Loretta 466782007d Refactor string interning to use position-based cache
Implement a new position-based string interning mechanism in AcBinarySerializer/AcBinaryDeserializer. This approach tracks stream positions for interned strings, ensuring 100% reliable cache matching during deserialization, even when strings are skipped or reordered. The serializer now writes (position, cacheIndex) pairs in the footer for all repeated strings, and the deserializer uses this mapping for robust cache population. Removes the old buffer-based interned string logic, updates all relevant code paths, and simplifies interned string handling for greater correctness and maintainability. Also updates benchmarks and test data construction to use the new interning mode.
2026-01-27 13:02:16 +01:00
Loretta 11ac2beb71 Add IsStringInternProperty to BinaryPropertyAccessorBase
Introduce IsStringInternProperty to cache the [AcStringIntern] attribute value for each property. Update the constructor to initialize this property, and revise class documentation to reflect the new addition. This enables efficient access to string interning settings per property.
2026-01-26 11:53:08 +01:00
Loretta ff73901ba8 Remove property name index caching from binary serializer
Simplifies property name registration by removing per-accessor
index caching and related reset logic. Deletes
RegisterPropertyNameAndCache and CachedPropertyNameIndex,
switching to direct property name registration. Also comments
out the global metadata cache in TypeMetadataBase, signaling
a move away from global caching. This reduces complexity and
potential for stale cache issues during context reuse.
2026-01-26 11:37:31 +01:00
Loretta e73fd7ae4a Refactor string interning to use enum and attribute
Replaces boolean UseStringInterning with StringInterningMode enum for more granular control (None, Attribute, All). Introduces AcStringInternAttribute for per-property interning configuration. Updates all usages and documentation to reflect the new approach, ensuring explicit and flexible string interning behavior in serialization. Default mode is now All to preserve legacy behavior.
2026-01-26 11:04:25 +01:00
Loretta 1a77ee4bf9 Refactor serializer options, string fast paths & analysis
- Refactor all serializer options to use properties returning new instances (no shared mutable state); update all usages accordingly
- Extract AcSerializerOptions, BinaryTypeCode, and BinaryPropertyFilterContext to dedicated files for clarity and reuse
- Add DEBUG-only string interning analysis/reporting tools to AcBinarySerializer
- Improve AcBinarySerializer string property serialization with direct typed getter and SIMD-optimized ASCII path
- Increase benchmark/test warmup iterations and add JIT warmup delays for more reliable performance measurements
- Remove redundant usings and update documentation/comments throughout
- No breaking API changes, but static readonly options fields are now properties
2026-01-25 16:40:40 +01:00
Loretta 145cc0a493 Add profiler mode & optimize AcBinary string interning
- Add "profiler" mode for memory profiling AcBinary serialization
- Reduce warmup iterations from 10 to 5 for faster benchmarks
- Save large test binary output to separate .output file (hex dump)
- Improve robustness of AcBinary vs MessagePack result comparison
- Use DisplayName for test data in result output for clarity
- Optimize AcBinary string interning: use single contiguous buffer
- Update WriteFooterStrings to avoid per-string allocations
- Clarify WithoutReferenceHandling() disables string interning for speed
2026-01-24 13:18:33 +01:00
Loretta 6df5c53937 Improve shared reference handling & benchmark realism
- Test data now controls IId shared ref % for realistic deduplication benchmarks; display names include IId ref ratio.
- Added deep-level clearing of IId refs for realistic object graphs.
- Pallet, Measurement, and Point models now support shared IId refs.
- TestDataFactory passes shared refs to all hierarchy levels.
- Refactored TypeMetadataWrapper for type-specific Id getters, identity maps, and registration—removes hot path type checks/switches.
- AcBinary deserializer now uses new typed methods for reference tracking and registration.
- SerializationContextBase uses pre-cast Id getters for zero-overhead tracking.
- Reduced quick benchmark warmup iterations for faster startup.
- Improves performance, clarity, and maintainability of reference handling and benchmarks.
2026-01-24 01:39:30 +01:00
Loretta 40fb4950a6 Refactor AcBinary reference handling and wire format
- Unify and clarify object reference tracking for IId and non-IId types
- Always write/read Id as a normal property with type marker for IId types
- For non-IId types (All mode), use hashcode prefix for reference tracking
- Remove special Id prefix logic; all properties use type markers
- Centralize hashcode registration logic in deserializer
- Improve error handling for missing references
- Refactor tests to cover all ReferenceHandlingMode values and verify both data integrity and reference identity
- Add hex dump utility for debugging serialized bytes
- Make TypeMetadataBase.SourceType public for better diagnostics
2026-01-23 23:42:39 +01:00
Loretta de2727ac8a Improve reference handling for serializers and IId types
- Make ReferenceHandlingMode type-aware; OnlyId fully supported for binary, All is default for JSON
- ReferenceHandling is now settable; add ThrowOnCircularReference option
- Always sort Id property first for IId types to optimize tracking
- Serialize/deserialize IId.Id without type marker when reference handling is enabled
- Contexts now delegate options-derived properties to Options
- Improve skip logic and property filter performance in binary serializer
- Update tests to explicitly set ReferenceHandlingMode.All
- Refactor internal APIs for clarity, safety, and efficiency
2026-01-23 20:32:51 +01:00
Loretta 852ab53af3 Refactor serializer contexts to use generic options type
Refactored AcSerializerContextBase and all derived context classes to accept a generic TOptions parameter, ensuring type-safe access to serializer/deserializer options. Updated Reset methods and option-dependent properties to use the strongly-typed Options property. Added helper methods for reference handling checks and performed minor code cleanups for consistency. This improves type safety, reduces runtime errors, and clarifies context usage across serialization formats.
2026-01-23 11:21:42 +01:00
Loretta cdf3cf34f8 Refactor: unify reference handling, footer string interning, benchmarks
- Replace UseReferenceHandling bool with ReferenceHandlingMode enum across all serializers and options
- Move AcBinary string interning to footer (no header shifting); remove bloom filter
- Overhaul benchmark console: multi-serializer, grouped/colorized results, CSV/log output, more test data
- Set UseMetadata = false by default (header property names unused)
- Update all context Reset/Pool logic for new options signature
- Update AcJson/Toon serializers for new reference handling
- Update tests and usages for new enum-based options
- Add Newtonsoft.Json to benchmark dependencies
- Misc: code cleanups, improved comments, clarify logic
2026-01-23 10:50:19 +01:00
Loretta 905b1c404d Refactor property metadata; add console perf profiler
- Introduced PropertyMetadataBase to unify property metadata and dynamic getter logic, now shared by PropertyAccessorBase and PropertySetterBase.
- Moved PropertyAccessorType enum to PropertyMetadataBase.
- Replaced all GetDynamicValue usages with GetValue for consistent property access in serializers/deserializers.
- Refactored PropertyAccessorBase and PropertySetterBase inheritance and responsibilities.
- Added MaxStringInternLength option to AcBinarySerializerOptions for configurable string interning.
- Improved collection deserialization: clear destination if source is empty.
- Added AyCode.Core.Serializers.Console project for performance profiling (with MessagePack comparison).
- Updated solution file to include new project and build configs.
- Minor code cleanups and documentation improvements.
2026-01-21 16:47:40 +01:00
Loretta 75823d593b Refactor: centralize strongly-typed property accessors
Move strongly-typed getter/setter logic and PropertyAccessorType enum into PropertyAccessorBase and PropertySetterBase, eliminating duplication in binary accessor classes. Expose direct typed getter/setter methods and new SetValueTyped/SetToDefault helpers. Rename ObjectGetter to DynamicGetter and update all serializers/deserializers to use GetDynamicValue. Centralize default value logic and improve performance by reducing boxing/unboxing. This unifies and streamlines property accessor infrastructure across all serializers.
2026-01-21 10:36:06 +01:00
Loretta 8f35f172f0 Refactor serialization/deserialization context base classes
Introduce SerializationContextBase and DeserializationContextBase to separate serialization and deserialization logic. Move tracking API from AcSerializerContextBase to SerializationContextBase, and add generic identity map methods to TypeMetadataWrapper for type-safe object tracking. Update all context classes to inherit from the new base classes. Comment out shared reference tracker and property mapping cache classes. Clean up unused usings and obsolete code. This improves code organization, performance, and maintainability.
2026-01-20 19:49:55 +01:00
Loretta 7d133a4b24 Add IId-aware reference tracking to serializer/deserializer
Enhances both binary deserialization and JSON serialization to support IId-based reference tracking and handling. Refactors object reference reading in AcBinaryDeserializer to use a unified TryGetValue approach. Adds IId-aware tracking, ID writing, and reference lookup methods to AcJsonSerializer and updates ScanReferences and WriteObject to use them. Improves support for custom identity types and robust reference management.
2026-01-20 08:58:07 +01:00
Loretta 6dbe4d76c1 Refactor reference tracking to use per-type identity maps
Replaces flat object reference dictionary with per-type identity maps in deserializer, improving type safety and efficiency for IId types. TypeMetadataWrapper now uses cached typed delegates for reference ID access. Centralizes complex type detection and exposes IsComplexType and TypedIdGetter in metadata. Updates all registration and lookup logic to use wrappers, removes obsolete metadata cache, and ensures thread-safe, type-aware reference handling throughout. Comments out legacy code for easier review and rollback.
2026-01-20 07:23:02 +01:00
Loretta dc2526da7e Refactor IId reference tracking for binary serialization
Unifies IId-based reference handling for binary serialization and deserialization. Introduces BinaryDeserializationContextClass for heap-based IId tracking, refactors IdentityMap<TId> for unified object storage, and removes legacy IIdReferenceTracker logic. Updates deserializer to use the new infrastructure for all IId types (int, long, Guid) and correct wire formats. Enhances tests for reference identity and object graph integrity. Improves code clarity and maintainability.
2026-01-19 14:37:42 +01:00
Loretta 09a61539fa Refactor: single-pass ref tracking, restrict IId<T> types
Refactored serialization reference tracking to a single-pass, inline approach, removing the previous two-pass scan. Only int, long, and Guid are now supported as IId<T> types; exotic ID types are no longer allowed. Cleaned up related enum values and code paths, defaulting non-IId types to int-based reference IDs. This simplifies the codebase and improves performance and type safety.
2026-01-18 16:25:09 +01:00
Loretta 8161ddade4 Refactor: unify metadata and tracking for serializer contexts
Major refactor of serialization infrastructure:
- Removed AcSerializeBase; replaced with AcSerializerContextBase<TMetadata> for unified context management.
- Added TypeMetadataWrapper<TMetadata> to combine metadata and per-context tracking state.
- All serializer contexts now inherit from AcSerializerContextBase and use context.GetWrapper(type) for metadata and tracking.
- Reference tracking for IId types is now type-safe and efficient (bitmaps for small int IDs, generic identity maps for others).
- Removed generic ThreadLocal caching from TypeMetadataBase; caching now uses global ConcurrentDictionary.
- Updated all type metadata classes to inherit from non-generic base.
- Added IdPropertyInfo and MetadataType to TypeMetadataBase.
- Added stub context base classes for JSON and Toon.
This centralizes and optimizes metadata/tracking, improves performance, and prepares for future extensibility.
2026-01-18 15:31:45 +01:00
Loretta 2ab640b375 Refactor serialization reference tracking and contexts
- Rework SerializationReferenceTracker to use a unified Bloom filter + HashSet for both IId and reference-based tracking, improving efficiency and reducing allocations.
- Introduce AcSerializeBase as a common base class for serialization contexts; update Binary, JSON, and Toon contexts to inherit from it.
- Move AcBinaryDeserializationException, AcJsonDeserializationException, and TypeConversionInfo to separate files for better organization.
- Remove obsolete code and update documentation to reflect new reference tracking logic.
2026-01-17 10:06:46 +01:00
Loretta 858d43b881 Refactor: add SerializeTypeMetadataBase for serializers
Introduce SerializeTypeMetadataBase<TMetadata> as a new abstract base class for serializer type metadata, extending TypeMetadataBase. Update Binary, JSON, and Toon serializer metadata classes to inherit from this new base, enabling shared serializer-specific logic and improving code organization. No functional changes to serialization behavior.
2026-01-17 09:42:06 +01:00
Loretta 63ab695a0b Refactor: Rename and reorganize serializer metadata classes
Replaces BinaryTypeMetadata, JsonTypeMetadata, and ToonTypeMetadata with BinarySerializeTypeMetadata, JsonSerializeTypeMetadata, and ToonSerializeTypeMetadata, moving each to its own file. Updates all references and documentation to use new names. Property accessor classes are retained and relocated. Also sets SignalR logging minimum level to Error. No changes to serialization logic; this is a structural/naming refactor for clarity and separation of concerns.
2026-01-17 09:20:06 +01:00
Loretta e3a66857aa IId-based reference deduplication for serialization
Adds robust IId<T>-based reference deduplication to both serialization and deserialization. Objects with the same type and Id are now treated as the same reference, reducing output size and ensuring correct reference identity in complex graphs.

Key changes:
- TypeMetadataBase: Adds IdAccessorType, typed Id getters, and precomputed property arrays for zero-boxing and fast access.
- AcSerializerCommon: Introduces IIdReferenceTracker for efficient (Type, Id) → object mapping.
- SerializationReferenceTracker: Now supports both ReferenceEquals and IId-based tracking for scanning and writing.
- AcBinarySerializer: Reference scan uses IId-aware deduplication, skipping types that don't need tracking.
- AcBinaryDeserializer: Adds per-context IId caches to ensure reference identity on deserialization.
- PropertyAccessorBase: Adds IsComplexType for fast scan decisions.
- Populate/Chain: Integrated with new IId cache for correct deduplication.
- Tests: Adds/updates tests for IId identity, cross-type safety, and diagnostics.
- Benchmarks: Adds WithRef/NoRef and AcJson vs System.Text.Json.
- Documentation: Includes detailed implementation plan and rationale.

No breaking changes for types that do not use IId. Zero-boxing for int/long/Guid Ids. Reference identity is now preserved for all IId objects.
2026-01-16 22:55:52 +01:00
Loretta a4c99853ce Add domain context to Toon meta; IId ref tests for JSON/Bin
- Support optional domain context in Toon serializer metadata (@meta section now includes "context" property if provided).
- Update internal and public APIs to accept and propagate domain context.
- Add overloads for Serialize, SerializeTypeMetadata, and SerializeMetadata to allow specifying domain context.
- Add AcBinarySerializerIIdReferenceTests and AcJsonSerializerIIdReferenceTests to verify IId-based reference deduplication and reference identity for both binary and JSON serializers.
- Tests cover both int and Guid IId scenarios, data integrity, and output size efficiency.
2026-01-16 09:27:59 +01:00
Loretta ba23251644 Add ToonDescription metadata to entities and DTOs
Expanded use of the ToonDescription attribute across core entities and DTOs to provide rich metadata, including business rules, purposes, and status flags. Added class-level and property-level annotations to improve self-documentation and support automated tooling. Introduced new computed properties with ToonDescription in ProductDto, StockQuantityHistoryDto, and StockTakingItem. Updated ToonTypeRelation with an Entity constant. Enhanced test coverage for Toon metadata. Cleaned up imports and removed obsolete test_debug.ps1 script. Updated settings.local.json to support additional Bash commands for tooling. These changes improve introspectability and support for serialization, UI, and API documentation.
2026-01-15 11:33:34 +01:00
Loretta 024b19b830 Add business-logic metadata to DTO serialization
Introduce "business-logic" field in AcToonSerializer type metadata output, sourced from ToonDescription attributes on DTO properties. Annotate relevant OrderDto and OrderItemDto properties with business rules and constraints. Expand allowed Bash commands in settings.local.json. Add test script to verify business-logic metadata presence. Temporarily disable HasToonIgnoreAttribute logic in JsonUtilities.
2026-01-14 22:16:49 +01:00
Loretta c631006303 Use C# 12 [] syntax for empty ToonPropertyAccessor array
Replaced Array.Empty<ToonPropertyAccessor>() with the new C# 12 collection expression [] for initializing the Properties field as an empty array, resulting in more concise and modern code.
2026-01-14 21:04:00 +01:00
Loretta de532c3bc7 Refactor Toon serializer: modularize metadata & relations
Major refactor: split AcToonSerializer.MetaSection.cs into focused modules for meta writing, type/enum definitions, navigation, foreign key, validation, descriptions, placeholders, topological sort, and attribute detection. Extend ToonDescriptionAttribute with BusinessRule, TypeRelation, and RelatedTypes for richer metadata. Add ToonTypeRelation constants. Annotate all DTOs with ToonDescription for type relationships. Refactor TypeMetadataBase for customizable ignore filters. Update tests and settings. Improves maintainability, extensibility, and metadata accuracy.
2026-01-14 15:39:03 +01:00
Loretta 93d38d427f Refactor Toon serializer: robust navigation/type metadata
- Introduce AcNavigationPropertyInfo for unified, cached relationship metadata per property (primary key, navigation type, FK, other key, inverse, target type)
- Refactor relationship detection to use AcNavigationPropertyInfo, replacing ad-hoc logic and old RelationshipMetadata
- Add AcSerializerCommon.GetCSharpTypeName for consistent, C#-style type name formatting (handles primitives, generics, nullables, enums, collections)
- Use topological sort for @types output to ensure dependency order
- Improve enum handling: avoid redundant constraints, use new type name formatter for underlying types
- Output navigation, foreign-key, other-key, and inverse-property metadata consistently in meta section
- Enhance convention-based detection for inverse properties and "other key", including unidirectional/polymorphic support
- Add comprehensive test for navigation metadata completeness and demo test entities
- Add "source-code-language: C#" to meta section
- Misc: code cleanup, remove unused cache, improve property filtering
2026-01-14 08:00:32 +01:00
Loretta 9312298032 Refactor AcToonSerializer metadata extraction & DTO tables
- Remove redundant constraints (nullable, numeric, boolean) from metadata; only explicit [Required] is documented.
- Exclude enum values from constraints; add "readonly" for readonly/init-only properties.
- Filter out primitives from documented types; only complex types and enums are included.
- Detect and document enum backing fields with "enum-type" constraint.
- Only output descriptions if explicitly provided; no fallback/inferred text.
- Add "not-mapped" constraint for [NotMapped]/[NotColumn] properties.
- Switch FruitBankHybrid.Shared.Tests.csproj to direct AyCode.Core project reference.
- Add both LinqToDB and DataAnnotations [Table] attributes to DTOs for ORM compatibility.
2026-01-13 08:25:28 +01:00
Loretta 3400cbc65a Improve AcToonSerializer type metadata handling & tests
- Refined type metadata serialization: collections and dictionaries are now detected and described more accurately, avoiding generic type names (e.g., List`1) and redundant "object" element types.
- Added circular reference protection to type name generation to prevent stack overflows and duplicate type names.
- Updated AcToonSerializerOptions.Compact to use indentation for better readability.
- Introduced ToonTests with unit tests to ensure type metadata correctness, uniqueness, and clarity.
- Added AyCode.Core project to the solution and adjusted namespaces/usings for consistency.
2026-01-12 08:36:23 +01:00
Loretta 223036f8e9 Add Toon serializer: LLM-optimized format & logging
Introduced AcToonSerializer, a new high-performance, LLM-friendly serialization format (Toon) with explicit meta/types/data sections, rich type metadata, and smart inference for property documentation. Added ToonDescriptionAttribute for custom schema annotations and relationship metadata. Implemented fallback/placeholder system merging custom, Microsoft, and inferred metadata. Enhanced logging: AcLoggerBase now implements ILogger, with provider/extensions for DI integration. Updated SignalR client to use AcLogger. Added ToonExtendedInfo.txt with full documentation. No breaking changes to existing serialization.
2026-01-12 07:16:41 +01:00
Loretta d2caa2234d Enhance Toon serialization with relationship & table metadata
- Add automatic detection of primary/foreign keys, navigation types, and table names via ToonDescription, EF Core/Linq2Db attributes, or convention
- Extend ToonDescriptionAttribute with IsPrimaryKey, ForeignKey, Navigation, InverseProperty, and TableName
- Output relationship and table metadata in @types section (enhanced and simple modes)
- Document enums in @types with numeric values and descriptions
- Optimize token usage: compact output when indentation is off
- Show dictionary key/value types in output
- Add SerializeMetadata(IEnumerable<Type>) API for multi-type docs
- Refactor and improve documentation throughout
2026-01-12 07:11:57 +01:00
Loretta bbb21dbb67 Add Toon serializer: LLM-optimized format & rich metadata
Introduces Toon (Token-Oriented Object Notation), a new serialization format designed for LLM readability and token efficiency. Adds core Toon serializer, options, attribute system (ToonDescriptionAttribute), and comprehensive documentation. Supports explicit type metadata, smart fallback/placeholder logic, multi-turn workflows, reference handling, and multi-line strings. No breaking changes; Toon is opt-in and complements existing JSON/binary serializers.
2026-01-10 20:13:54 +01:00
Loretta 028c80db94 Integrate AcLogger with Microsoft.Extensions.Logging
AyCode.Core loggers now implement the ILogger interface, enabling direct integration with Microsoft.Extensions.Logging. Added AcLoggerProvider and extension methods for easy DI registration. Internal LogLevel usages are now AcLogLevel to avoid confusion. This allows seamless use of AyCode loggers in ASP.NET Core and other .NET apps using standard logging abstractions.
2026-01-09 11:12:35 +01:00
Loretta 46c12bf5be Add /reports to .gitignore
Now the /reports directory will be ignored by Git, preventing it from being tracked in the repository. This helps keep generated or report files out of version control.
2026-01-06 08:59:38 +01:00
Loretta 05e91aab60 Add AcBinary Source Generator for fast serialization
Introduce Roslyn Source Generator for AcBinary serialization, generating optimized Serialize/Deserialize methods for types marked with [AcBinarySerializable]. Integrate generator as analyzer in core, tests, and benchmarks. Update metadata to detect generated serializers. Add benchmarks and integration tests to validate performance and correctness. Update project files and internals visibility for testing. Existing runtime serialization remains as fallback.
2026-01-06 08:58:34 +01:00
Loretta ceb8c3d886 Add /reports to .gitignore
Now the /reports directory will be ignored by Git, preventing it from being tracked in the repository. This helps keep generated or report files out of version control.
2026-01-06 08:58:03 +01:00
Loretta 1f2f06ff8c Refactor and unify object/collection deserialization logic
Refactored deserialization to use a unified PopulateObjectCore method, replacing PopulateObjectMerge and PopulateObjectNested to reduce duplication. Improved and centralized IId collection merge logic, with automatic detection and handling in merge mode. Reference ID registration is now consistent for reused objects and collections. Simplified SetPropertyToDefault to set collections to null. Updated documentation and clarified merge mode handling throughout. These changes improve maintainability, consistency, and robustness of deserialization.
2026-01-05 10:30:38 +01:00
Loretta fd3487c12b Update enum values, PropertySkip code, and add int tests
- Changed TestStatus enum to use non-sequential values (5, 10, 20, ...)
- Updated related tests and deserialization logic for new enum values
- Changed PropertySkip marker from 253 to 191 to avoid TinyInt conflicts
- PropertySkip now only written for null references, not empty values
- Improved handling of skipped enum and nullable properties in deserializer
- Enhanced compiled property setter for nullable types
- Added comprehensive int serialization tests, including edge cases
- Fixed namespace casing and added missing using directive
2026-01-05 09:44:02 +01:00
Loretta 65a1d25586 Optimize binary serialization with PropertySkip marker
Refactored object serialization to use fixed property order and a new PropertySkip marker for default/null values, removing property count and index overhead. Updated deserialization logic to handle skip markers and set defaults efficiently. Added WritePropertyOrSkip and SetPropertyToDefault methods for single-pass, boxing-free property handling. SkipObject now throws for new format. Updated BinaryTypeCode, .gitignore, and settings.local.json.
2026-01-04 20:14:41 +01:00
Loretta 4b9e1490ef ... 2026-01-04 09:40:32 +01:00
Loretta 9ad84ec21e Refactor type metadata caching for serializers/deserializers
Major overhaul of type metadata caching:
- Introduced generic TypeMetadataBase<T> with built-in ThreadLocal and global caching, replacing all per-class static caches.
- Updated all serializer/deserializer metadata classes to use the new base, unifying and simplifying cache logic.
- Increased ThreadLocal cache size for better performance with many types.
- Standardized property collection order and improved property array usage.
- Updated documentation and comments to reflect new caching strategy.

These changes improve performance, scalability, and maintainability while reducing code duplication.
2026-01-03 09:50:30 +01:00
Loretta 60ca154c6f Refactor JSON/Binary context & metadata class structure
Renamed and split internal context and metadata classes for JSON and binary serialization/deserialization.
- Replaced CrossTypeDeserializerBase with DeserializeCrossTypeBase; updated all usages.
- Renamed DeserializationContextPool to JsonDeserializationContextPool; SerializationContextPool now uses JsonSerializationContext.
- Renamed DeserializeTypeMetadata to JsonDeserializeTypeMetadata; TypeMetadata to JsonTypeMetadata, each in their own files.
- Updated all method signatures and internal references to use new names.
- Simplified BinaryDeserializeTypeMetadata by removing internal property dictionary.
No changes to public APIs; improves code clarity and maintainability.
2026-01-03 08:34:49 +01:00
Loretta f875738b08 Refactor SignalR dynamic method lookup with static registry
Introduce AcDynamicMethodRegistry<TAttribute> for efficient, static caching and lookup of SignalR methods by messageTag and type. Replace per-instance method lists with a high-performance registry, update all registration and invocation logic to use the new approach, and make method metadata caching type-based and immutable. Also expand Bash permissions in settings.local.json and rename ReadVarUIntFromBytes for consistency. This improves performance, maintainability, and code clarity for dynamic SignalR method invocation.
2026-01-02 15:51:50 +01:00
Loretta f388afcede Add cross-type deserialization and property mapping support
- Enable deserialization and population from TSource to TDest with automatic or custom property mapping (by name or via PropertyMapper).
- Add PropertyMapperDelegate and options for custom mapping logic.
- Implement PropertyMappingCache and BinaryIndexMappingCache for efficient, thread-safe mapping reuse.
- Ensure stable, inheritance-aware property ordering in TypeMetadataBase for reliable cross-type mapping.
- Add CrossTypeDeserializerBase utility for shared cross-type logic.
- Add AcBinaryDeserializer.CrossType with new Deserialize<TSource, TDest> and Populate<TSource, TDest> overloads.
- Update settings.local.json to allow additional Bash commands for development.
- Improve documentation and add missing using directives.
2026-01-02 07:45:42 +01:00
Loretta 28a818b1ae Refactor serialization infra, add perf benchmarks
- Unified reference tracking for JSON/Binary serializers using int IDs
- Added ThreadLocalCache and shared SerializationReferenceTracker
- Refactored IId metadata caching into DeserializeTypeMetadataBase
- Optimized array/list iteration (span, index, ref) in serializers
- Added RefForeachBenchmark and ValueTypePassingBenchmark
- Enhanced AcObservableCollection with SynchronizationContext support
- Added LargeScaleBinaryBenchmark for production-like scenarios
- Improved benchmark result directory handling
- Skipped two complex JSON reference tests
- Miscellaneous code cleanup and documentation updates
2025-12-30 19:29:39 +01:00