branchrust_reboot/main/pool_mt/fuzzy_circularbuffercancel
16 Commits over 0 Days - ∞cph!
Bugfix: ensure UseMutexPool feature switch catches all pool calls
Now pools lazy-update their internal storage when toggling the feature switch - this makes sure calls are routed to the right pools
Tests: played on craggy, slapped breakpoints into Take and made sure no calls were made to fallback/new pool when new/fallback mode was set
Update: pool.usemutexpool convar (default 0) to optionally revert to original pool
- ran codegen(skipping protobuf due to mac weirdness)
Tests: booted into craggy and toggled the var. Checked pool capacities via pool.print_memory
Buildfix: missing files from previous submit
Clean: minor reaorganization + comments
Tests: unit tests
Clean: store buffer[pos] accesses in a variable
Just for easier code reading
Tests: ran unit tests
Clean(editor): get rid of Pool.UseSafetyChecks flag
- lock-free Pool can't ensure associated hashset consistency, so we can't use that anymore
- checking for null on Take call doesn't seem to make sense since awhile back
Tests: ran tests. StressTestMT doens't sporadically fail anymore
Optim: couple micro optims
- rewrite a couple branches into branchless logic
- inlined IsTurnTicketSameIgnoreProgress
- got rid of module via use of MADD
- added extra comments for explaining what's going on
AllocDeallocST: 2.82 -> 2.77ms for 10k allocs. Tiny, but every bit helps
Tests: ran unit and perf tests
Update: replace member variables with cacheline sized counterparts
Didn't see any notable change in perf tests, but wouldn't hurt
Tests: ran tests
Bugfix: rewrite fuzzy circular buffer to prevent gradual poisoning of the pool (hurt my brain)
Lost a bunch of perf(loses a bit to CircularBuffer in some tests, wins in others), but the spills are now minimal.
AllocDeallocST - Avg: 0.79ms, Created: 0 Spilled: 0
AllocDeallocMTShortLived - Avg: 4.03ms, Created: 22(0.07%) Spilled: 25(0.08%)
AllocDeallocMTLongLived - Avg: 3.84ms, Created: 0 Spilled: 0
AllocDeallocMPSC - Avg: 3.96ms, Created: 0 Spilled: 0
Tests: ran all unit and perf tests.
Update: use volatile int instead of Volatile.Read(ref long), as the latter is an expensive CAS
Existing code was using non-volatile read of long, but I don't think it's safe
Tests: ran perf tests
Update: fuzzy version of pool with CircularBuffer
Fastest so far, but has a tendency to spill/allocate in during very high contention
AllocDeallocST - Avg: 0.63ms, Created: 0 Spilled: 0
AllocDeallocMTShortLived - Avg: 2.79ms, Created: 144(0.45%) Spilled: 169(0.53%)
AllocDeallocMTLongLived - Avg: 2.94ms, Created: 0 Spilled: 0
AllocDeallocMPSC - Avg: 3.26ms, Created: 0 Spilled: 0
Tests: ran unit and perf tests