This is currently a layering violation, but just to observe: it's kind of a waste that we re-encode every block just after we decoded it.
Abstractly, it might make sense to handle compression outside of NBS, which would allow this. It would also maybe allow (at least in this case) for fewer allocations, since the only reason here to decode is to WalkRefs, but we could do that to a scratch area.
This is currently a layering violation, but just to observe: it's kind of a waste that we re-encode every block just after we decoded it.
Abstractly, it might make sense to handle compression outside of NBS, which would allow this. It would also maybe allow (at least in this case) for fewer allocations, since the only reason here to decode is to WalkRefs, but we could do that to a scratch area.