Allocate transformation cache value on heap #554
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously I thought TinyGo problems were solved by #553 but I hadn't let the bench run long enough to see it get slower over time, an indication of memory leak.
It seems like there is a bug in TinyGo - tinygo-org/tinygo#3358
The issue only happens with largeish values it looks like - so using a pointer for the value appears to make the problem go away. This is not ideal as it means heap allocation, something we wanted to avoid with this cache. But performance does seem to be a bit better on FTW (and presumably more so with larger payloads) with this change compared to without a transformation cache, so we can live with it until debugging further. The heap allocated object is a fixed, smallish size (it contains a couple of slices, not data itself) so it's not related to payload size as a saving grace