diff options
author | Fabricio Voznika <fvoznika@google.com> | 2019-04-29 15:32:45 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-04-29 15:33:47 -0700 |
commit | ddab854b9a895603664fa4abfa525f6a29047083 (patch) | |
tree | 349b428a042c7e7e0d7de71e56a319f7df3ae29b /pkg/p9/buffer.go | |
parent | 4d52a5520101a88424fb63dd99412a1db33fbd06 (diff) |
Reduce memory allocations on serving path
Cache last used messages and reuse them for subsequent requests.
If more messages are needed, they are created outside the cache
on demand.
PiperOrigin-RevId: 245836910
Change-Id: Icf099ddff95df420db8e09f5cdd41dcdce406c61
Diffstat (limited to 'pkg/p9/buffer.go')
-rw-r--r-- | pkg/p9/buffer.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/p9/buffer.go b/pkg/p9/buffer.go index 4c8c6555d..249536d8a 100644 --- a/pkg/p9/buffer.go +++ b/pkg/p9/buffer.go @@ -20,7 +20,8 @@ import ( // encoder is used for messages and 9P primitives. type encoder interface { - // Decode decodes from the given buffer. + // Decode decodes from the given buffer. Decode may be called more than once + // to reuse the instance. It must clear any previous state. // // This may not fail, exhaustion will be recorded in the buffer. Decode(b *buffer) |