Closed codefromthecrypt closed 11 months ago
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: codefromthecrypt, sanposhiho
The full list of commands accepted by this bot can be found here.
The pull request process is described here
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
In our TinyGo guest, we have a read buffer used for unmarshalling protos. Before this change, any time the buffer was not big enough for a proto (such as a node or pod), a new one would be re-allocated, and the old buffer subject to garbage collection.
WebAssembly memory can grow, but not shrink, so even if we do allocate a large buffer and throw it away, and it is garbage collected.. the wasm memory will stay fixed at the larger size. This change makes things more efficient by always increasing our read buffer whenever we are unmarshalling and the old one was too small.
Which issue(s) this PR fixes:
Special notes for your reviewer:
For precision, this uses benchmarks from #39 not main.
Does this PR introduce a user-facing change?
NONE
What are the benchmark results of this change?