Parent: #507. Est. 8-12% (including removing the 2nd probe).
Problem
Two wasteful things on the GET hot path:
cmd_get does Bytes::copy_from_slice(value) (cmd_string.rs:261) then encode put_slice into out = 2 value copies + 1 alloc. Redis/Dragonfly serve the inline value by reference: write $<len>\r\n<bytes>\r\n straight from the stored bytes into the output buffer = 1 write, 0 alloc, 1 copy (store to socket buffer, the only intrinsic one).
- The store does
find_mut().bump_freq() then find() (store lib.rs:981,984) = 2 SIMD group walks where 1 suffices (bump the freq + read the value through the same &mut).
Mechanism / fix
- Add a borrowing GET path: encode
$len\r\n + the value bytes directly from store.read's &[u8] into out (or a Value::BulkRef(&[u8]) variant), collapsing GET to a single store-to-out copy.
- Return the value + bump the frequency through ONE
find_mut (or one probe that both reads and bumps).
Risk / notes
Acceptance
- GET does 1 value copy (store to out) + 1 table probe.
- Byte-identical (differential green); store + server tests pass.
- A/B target: 8-12% GET.
Parent: #507. Est. 8-12% (including removing the 2nd probe).
Problem
Two wasteful things on the GET hot path:
cmd_getdoesBytes::copy_from_slice(value)(cmd_string.rs:261) thenencodeput_sliceintoout= 2 value copies + 1 alloc. Redis/Dragonfly serve the inline value by reference: write$<len>\r\n<bytes>\r\nstraight from the stored bytes into the output buffer = 1 write, 0 alloc, 1 copy (store to socket buffer, the only intrinsic one).find_mut().bump_freq()thenfind()(store lib.rs:981,984) = 2 SIMD group walks where 1 suffices (bump the freq + read the value through the same&mut).Mechanism / fix
$len\r\n+ the value bytes directly fromstore.read's&[u8]intoout(or aValue::BulkRef(&[u8])variant), collapsing GET to a single store-to-out copy.find_mut(or one probe that both reads and bumps).Risk / notes
outbefore the next command, so no pinning is needed.Acceptance