0e5ce4ed9b1c25c3df8068a76abd7f313c6eb5d7
Three optimizations making the serial fan-out path cheaper (fan-out 0.63x→0.70x,
multi pub/sub 0.65x→0.69x):
1. Pre-format MSG prefix ("MSG subject ") and suffix (" [reply] sizes\r\n") once
per publish. New SendMessagePreformatted writes prefix+sid+suffix directly into
_directBuf — zero encoding, pure memory copies. Only SID varies per delivery.
2. Replace queue-group round-robin Interlocked.Increment/Decrement with non-atomic
uint QueueRoundRobin++ (safe: ProcessMessage runs single-threaded per connection).
3. Replace HashSet<INatsClient> pcd with ThreadStatic INatsClient[] + linear scan.
O(n) but n≤16; faster than hash for small fan-out counts.
Description
No description provided
Languages
C#
99.9%