Repository navigation
⏲️ Monotonic clocks galore
Thanks to community members @unsafePtr and @GordeySt , clocks and clock-related operations are now more monotonic.
One case was about the internal use of Stopwatch.GetTimestamp() & friends instead of DateTimeOffset.UtcNow.Ticks: the former, on most platform, will make use of higher precision clocks which are not affected by wall-clock adjustments like NTP corrections, manual clock changes and so on.
The second is not so much about using monotonic clocks, but about guaranteeing monotonic advancements of clock measurements.
That would've been done thanks to the usage of Interlocked.Max()... but that is not currently available in .NET (see here).
So, long story short, we still got that thanks to a small utility method which contains the currently known best implementation available.
These 2 set of changes guarantee even more precise time keeping, even in extreme scenarios.
See here and here for the issues.
🔠 Better internal string comparisons
Community member @GordeySt noticed the lack of StringComparison usage in some internal method calls.
This led to 3 outcomes:
- a pretty nice perf improvements
- a fix for a potential bug related to culture handling
- better validation of custom internal strings
Any previous correct behavior should remain unchanged, and new improper behaviour is now shielded.
See here for the issue.
⚡ Perf boost
Regarding the perf improvements on the previous point, here's a taste for some method calls and hot paths:
| Scenario | Op | it-IT |
de-DE |
en-US |
|---|---|---|---|---|
| L1 hit | TryGet |
351 → 117 ns (−67%) | 378 → 122 ns (−68%) | 145 → 138 ns (−5%) |
| L1 hit | GetOrSetAsync |
477 → 270 ns (−43%) | 520 → 277 ns (−47%) | within noise |
| L1 hit, 2 tags | GetOrDefault |
1550 → 516 ns (−67%) | 1645 → 638 ns (−61%) | 669 → 621 ns (−7%) |
| L1 hit, 2 tags | GetOrSetAsync |
1887 → 863 ns (−54%) | 1792 → 891 ns (−50%) | 949 → 801 ns (−16%) |
| L2 hit | GetOrSet |
2985 → 1511 ns (−49%) | 2977 → 1516 ns (−49%) | 1848 → 1751 ns (−5%) |
| L2 hit | TryGetAsync |
3272 → 2140 ns (−35%) | 3470 → 2121 ns (−39%) | within noise |
Really nice, right?
📢 Backplane fix (Redis)
Community member @ChadNedzlek spotted a problematic edge case with the Redis-based backplane: a case of double-disposal of the Redis connection when the underlying muxer is passed via the MultiplexerFactory.
This is now fixed, thanks for spotting it!
See here for the issue.