Skip to content

Conversation

@posborne
Copy link
Collaborator

  • Create Dockerfile.tinygo template for TinyGo benchmarks
  • Add tinygo-json benchmark with encoding/json
  • Add tinygo-regex benchmark using standard library regexp

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.

cd "$dir"

# Build with TinyGo
"$TINYGO" build -o "$OUTPUT_DIR/tinygo-$benchmark.wasm" -target=wasi .
Copy link
Collaborator Author

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.
@posborne
Copy link
Collaborator Author

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".

@posborne
Copy link
Collaborator Author

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant