From 3165c9c8b0bc0c3e10f456c65dee9ad9a6f1bded Mon Sep 17 00:00:00 2001 From: Kacy Fortner Date: Sat, 14 Feb 2026 11:32:12 -0500 Subject: [PATCH] refactor: document why Frame::Map uses Vec over HashMap preserves insertion order (RESP3 maps are ordered) and avoids hashing overhead for the small maps typical in redis responses. --- crates/ember-protocol/src/types.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/ember-protocol/src/types.rs b/crates/ember-protocol/src/types.rs index a6be1224..c48c5cb3 100644 --- a/crates/ember-protocol/src/types.rs +++ b/crates/ember-protocol/src/types.rs @@ -33,6 +33,10 @@ pub enum Frame { Null, /// Ordered map of key-value frame pairs, e.g. `%1\r\n+key\r\n+val\r\n`. + /// + /// Uses `Vec` instead of `HashMap` to preserve insertion order (RESP3 + /// maps are ordered) and because typical maps in Redis responses are + /// small enough that linear scan beats hashing overhead. Map(Vec<(Frame, Frame)>), }