Files
amethyst/quic
Claude 0cc577f0fb perf(quic): skip closed streams + skip sort when uniform priority
Multiplexing-throughput investigation (qlog against aioquic):
~25 streams/sec with 1453 GETs in 58s. The bottleneck under high
stream count was drainOutbound's per-call O(N log N) sort over the
ENTIRE stream list (including streams that have already FIN'd both
ways and have nothing to send).

Two cheap optimizations to drainOutbound's stream iteration:
  1. Filter to !isClosed streams BEFORE sort. Most streams under
     bursty multiplexing loads are done; iterating them is wasted.
  2. Skip sortedByDescending entirely when every stream is at
     default priority (priority == 0). The pre-priority round-robin
     shape (insertion order) is preserved, satisfying the moq-lite
     newer-sequence-stream priority contract by happenstance for
     uniform-priority loads.

Drops drainOutbound's per-call cost from O(N log N) where N = total
streams to roughly O(active) under realistic loads. Multiplexing's
~2000 streams accumulated over a run drop down to maybe 64 active at
any moment (the chunk in flight).

Doesn't affect the moq-lite audio path's behavior (small N, default
priorities → both paths reduce to the same round-robin walk).

https://claude.ai/code/session_01HcvfQq1ttPV9PkRoJb4nyT
2026-05-07 01:50:32 +00:00
..