-
Notifications
You must be signed in to change notification settings - Fork 36
Add TinyGo JSON/Regex serialization benchmarks #302
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
base: main
Are you sure you want to change the base?
Conversation
benchmarks/tinygo/build.sh
Outdated
| cd "$dir" | ||
|
|
||
| # Build with TinyGo | ||
| "$TINYGO" build -o "$OUTPUT_DIR/tinygo-$benchmark.wasm" -target=wasi . |
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.
Here I think, at a minimum, we want -opt=2 and possibly -gc=leaking to match how this is used in serverless (ty @dgryski). I'm going to enable both of those and we can decide later if we want a bench that covers that tinygo gc.
- Create Dockerfile.tinygo template for TinyGo benchmarks - Add tinygo-json benchmark with encoding/json - Add tinygo-regex benchmark using standard library regexp
There's still a large divide with the rust regex bench but this brings things a bit closer from 32x slower to 19x slower in a quick benchmark.
2392a49 to
adbebd4
Compare
|
I didn't do it with this pass, but it should be possible to build the identical benchmarks with "big" go. That's probably not super useful in terms of coverage, but I may confirm that it works in order to allow for the top-level directory be renamed to just "go" vs. "tinygo". |
|
Big-go is a no-go here at present due to an interaction between:
I tried a few workaround local to the test; apart from fully embedding the input file we probably need to change the environment which would require changes to wasmtime (which is fine but less than ideal in terms of being able to benchmark older engines). |
| cd "$dir" | ||
|
|
||
| # Build with TinyGo | ||
| "$TINYGO" build -o "$OUTPUT_DIR/tinygo-$benchmark.wasm" -target=wasi -opt=2 -gc=leaking . |
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.
Can you add a comment here documenting why -gc=leaking is used here?
Sample size of one, but in some quick comparison the regex with tinygo is fairly slow taking ~32x which is somewhat surprising. CC @dgryski to review to ensure the workloads here are useful in representing some proxy of real-world workloads.
Given how much slower tinygo appears to be here it may make sense to truncate the input file to reduce the per-iteration time of the regex benchmark.
As with the previous round of benchmarks, portions of this PR were generated using an LLM though reworked a fair bit. I opted to use a single tinygo/ benchmarks subdirectory as it was easier to achieve reuse in that way that make it simpler to add other tinygo benchmarks as we see fit.