mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-10-27 00:00:15 +00:00
MpscTunnelSender::send now tries try_send first, falling back to send().await only when the channel is full. try_send bypasses the tokio batch_semaphore Acquire::poll + add_permits_locked machinery (~9.4% of CPU in samply profiling), which is pure overhead when the channel has capacity. In the ring-tunnel bench (4 threads, 1400B, 15s) the channel(32) fast path hits >99%, so the fallback rarely triggers. Benchmark improvement: pps: 230K -> 246K (+7.0%) send_msg_internal avg: 3.25us -> 3.13us (-120ns/pkt) forward_one_round calls: 2.46M -> 706K (-71%, bigger batches) All mpsc tests pass.