Commit Graph
5 Commits
Author SHA1 Message Date
fanyang ebb97fd4f4 refactor(stats): rename UnsafeCounter to Counter
The counter is now a plain atomic (no longer UnsafeCell, no longer
sharded), so the "Unsafe" prefix is a misleading leftover. Rename to
Counter. Also fix a stale bench comment that claimed the ShardedAtomic
variant mirrors production.
2026-06-25 00:59:49 +08:00
fanyang 7d249979ea Update outdated comment 2026-06-25 00:54:26 +08:00
fanyang 8fa161bc1b Fix clippy 2026-06-25 00:51:55 +08:00
fanyang 2624b2740e Code format 2026-06-25 00:48:40 +08:00
fanyang a247358ec1 test(bench): add counter contention benchmark
Adds benches/counter_contention.rs comparing the production CounterHandle
against reconstructed baselines (pre-optimization single-atomic + CAS +
Mutex<Instant>) under tokio-task contention, plus counter-only variants.
Uses the real stats_manager types so the numbers reflect shipped code.

Placed between the sharding and fastant commits so each can be benchmarked
independently: at this commit prod = sharded counter + Mutex<Instant> touch.
2026-06-25 00:06:38 +08:00