-
Notifications
You must be signed in to change notification settings - Fork 26
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
Fix performance degradation while host functions call #48
Fix performance degradation while host functions call #48
Conversation
Signed-off-by: Dmitry Volodin <dmvolod@gmail.com>
Signed-off-by: Dmitry Volodin <dmvolod@gmail.com>
@@ -32,6 +32,7 @@ func (h parserLibrary) ParseJson(ctx context.Context, request *ParseJsonRequest) | |||
} | |||
ptr, size := wasm.ByteToPtr(buf) | |||
ptrSize := _parse_json(ptr, size) | |||
wasm.FreePtr(ptr) |
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.
maybe for this cases we could have another variant of the ByteToPtr
that does not perform any allocation ?
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.
Yes, this can be an option for host functions only, but need to validate that's GC working correctly in this case
ps you can use https://pkg.go.dev/golang.org/x/perf/cmd/benchstat to format the before after so it is easier to read. |
Yes, sure. Changed to the new format |
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.
thanks, this is a significant fix!
Issue #, if available:
This is probably one of the option to fix performance issue
Description of changes:
Hosts functions performance tests before fix
Hosts functions performance tests after fix
Hosts functions performance tests for
v0.7.0
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
cc: @codefromthecrypt , @lburgazzoli