Where
src/network/dpi/quic.rs:370-371
let dcid = payload[offset..offset + dcid_len].to_vec();
quic_info.connection_id = dcid.clone();
quic_info.connection_id_hex = None;
offset += dcid_len;
What
The long-header QUIC parser allocates the DCID bytes into a Vec<u8>, then clones that Vec into quic_info.connection_id, and only later passes &dcid to extract_tls_from_long_header_packet. The second to_vec/clone round-trip allocates a duplicate Vec for every long-header QUIC packet parsed.
The short-header path had the exact same shape and was fixed in #317 (commit b4a8…). The long-header path was missed.
Why it matters
QUIC initial-packet parsing is on the DPI hot path for every QUIC flow (HTTP/3, increasing share of web traffic). The DCID size varies by deployment but commonly 8-20 bytes; the wasted allocation is small per packet, large in aggregate.
Suggested fix
Drop the intermediate let dcid = …to_vec() and assign quic_info.connection_id directly from the payload slice. Capture the dcid byte-range and pass &payload[dcid_range] to extract_tls_from_long_header_packet — no separate Vec needed since the function takes dcid: &[u8].
Where
src/network/dpi/quic.rs:370-371What
The long-header QUIC parser allocates the DCID bytes into a
Vec<u8>, then clones thatVecintoquic_info.connection_id, and only later passes&dcidtoextract_tls_from_long_header_packet. The secondto_vec/cloneround-trip allocates a duplicateVecfor every long-header QUIC packet parsed.The short-header path had the exact same shape and was fixed in #317 (commit
b4a8…). The long-header path was missed.Why it matters
QUIC initial-packet parsing is on the DPI hot path for every QUIC flow (HTTP/3, increasing share of web traffic). The DCID size varies by deployment but commonly 8-20 bytes; the wasted allocation is small per packet, large in aggregate.
Suggested fix
Drop the intermediate
let dcid = …to_vec()and assignquic_info.connection_iddirectly from the payload slice. Capture the dcid byte-range and pass&payload[dcid_range]toextract_tls_from_long_header_packet— no separateVecneeded since the function takesdcid: &[u8].