From 368d140b5b8dcb84d19a026114e5ea16b52f00dd Mon Sep 17 00:00:00 2001 From: fanyang Date: Sun, 28 Jun 2026 18:41:40 +0800 Subject: [PATCH] hotpath: add measure to try_compress_and_encrypt and get_msg_dst_peer_ipv4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Splits the 1.04us gap between send_msg_by_ip and send_msg_internal: try_compress_and_encrypt: 386ns (37%) ← AES-GCM encrypt + zstd compress get_msg_dst_peer_ipv4: 161ns (15%) ← IP→peer_id route lookup run_nic_packet_process_pipeline: 121ns (12%) ← ACL check other (fill_hdr + counters): ~440ns (36%) The 386ns encrypt is the largest optimization opportunity in this gap: ring tunnel is in-process, so application-layer encryption may be skippable. --- easytier/src/peers/peer_manager.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/easytier/src/peers/peer_manager.rs b/easytier/src/peers/peer_manager.rs index f85beaef..6bbbfa64 100644 --- a/easytier/src/peers/peer_manager.rs +++ b/easytier/src/peers/peer_manager.rs @@ -1633,6 +1633,7 @@ impl PeerManager { .collect() } + #[cfg_attr(feature = "hotpath", hotpath::measure(impl_type = "PeerManager"))] pub async fn get_msg_dst_peer_ipv4(&self, ipv4_addr: &Ipv4Addr) -> (Vec, bool) { let mut is_exit_node = false; let mut dst_peers = vec![]; @@ -1701,6 +1702,7 @@ impl PeerManager { (dst_peers, is_exit_node) } + #[cfg_attr(feature = "hotpath", hotpath::measure(impl_type = "PeerManager"))] pub async fn try_compress_and_encrypt( compress_algo: CompressorAlgo, encryptor: &Arc,