-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
examples(allocation): ensures data used in host functions isn't freed before invocation #1434
Conversation
Thanks! mind doing this and sharing (before/after bench) in the PR description? # from main
go test -run='^$' -bench '^BenchmarkAllocation.*' ./internal/integration_test/vs/compiler -count=6 > old.txt
# from this commit
go test -run='^$' -bench '^BenchmarkAllocation.*' ./internal/integration_test/vs/compiler -count=6 > new.txt
benchstat old.txt new.txt |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code wise I like it.
While personally, I rarely understand when I'm supposed to do runtime.KeepAlive
, this seems the pattern to do it. What I like also is that the stringToPtr code is more concise.
One homework before merge is checking that unsafe.StringData won't return nil when compiled with TinyGo's wasi target.
While we're at it, is there a reason not to do the below change: wazero/examples/allocation/tinygo/testdata/greet.go Lines 66 to 68 in 3c01f86
Seems to match guidance from tinygo-org/tinygo#1284 |
6bd4122
to
c1f1bd5
Compare
Sorry I wasn't sure which line we were proceeding with, so I commented on #1436 (review) instead of this one. Feel free to proceed forward with whatever, as I've already bookmarked 1436 for next time |
I think we should merge this one. I did my changes offline and didn't notice this PR before push. |
No objection merge either this or #1436 , they are essentially equivalent |
… before invocation Signed-off-by: Luca Burgazzoli <[email protected]>
merged #1436 thanks @lburgazzoli |
No description provided.