v3.3.12
-
LazyWeakReference:- Added intrusive doubly-linked list fields
_prevand_nextfor internal queue management. - Simplified
targetandtargetIfStronggetters using null-coalescing.
- Added intrusive doubly-linked list fields
-
LazyWeakReferenceManager:- Replaced
SplayTreeSetwith an intrusive doubly-linked aging queue (_head,_tail) for strong references. - Added
_pushBackand_removemethods for O(1) insertion and removal in the aging queue. - Updated
_handleNewStrongRefand_handleAccessStrongRefto use the intrusive queue. - Updated
_handleNewWeakRefand_handleDisposedRefto remove references from the queue using_remove. - Refactored
_weakenStrongRefsto process references from the queue head and schedule next weakening based on precise delay. - Improved queue management to avoid allocations and maintain ordering by last strong access time.
- Replaced
Performance Improvements
- Replaced the internal
SplayTreeSetused for aging strong references with an intrusive doubly-linked aging queue. - Benchmark (300k operations, steady set ≈20k items):
| Structure | Avg Time |
|---|---|
| Intrusive aging queue | ~22 ms |
| Queue | ~35 ms |
| WeakRef queue | ~60 ms |
| SplayTreeSet (previous) | ~205 ms |
-
Impact:
- ~9× faster than the previous
SplayTreeSetimplementation - ~35% faster than
Queue - Lower GC pressure and allocation overhead
- Constant-time weaken cycles with stable latency under high churn
- ~9× faster than the previous