Skip to content

Benchmarking wazero #9

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

Merged
merged 1 commit into from
Nov 16, 2023
Merged

Benchmarking wazero #9

merged 1 commit into from
Nov 16, 2023

Conversation

Seb-C
Copy link
Contributor

@Seb-C Seb-C commented Nov 11, 2023

This adds a benchmark for Wazero.

Now I am not sure if the comparison is 100% correct, because wasm is lower level, and would require some additional boilerplate to pass or receive arguments other than integers or floats (which btw is feasible via https://github.com/knqyf263/go-plugin, but it's using protocol buffers).

But I was interested in having a rough idea of the performance anyway.

I originally planned to compare it to wasmer-go, wasmtime-go and wasmedge, but I could not get those to work.

At the moment, the native go compiler only provides //go:wasmimport directives and no //go:wasmexport, which makes it unusable with GOARCH=wasm (hence the need for tinygo). But once it does in the future, it would be nice to have the same benchmark for both compilers.

Results on my computer (I did not update the readme because I am not sure what was the referential for the benchmark there):

goos: linux
goarch: amd64
pkg: github.com/uberswe/go-plugin-benchmark
cpu: AMD Ryzen 5 5600 6-Core Processor              
BenchmarkPluginRandInt/golang-plugin-12                                 171194259                7.103 ns/op
BenchmarkHashicorpGoPluginRandInt/hashicorp-go-plugin-12                   29697             40213 ns/op
BenchmarkPieRandInt/pie-12                                                 47438             25980 ns/op
BenchmarkPingoTcpRandInt/pingo-tcp-12                                      28970             38373 ns/op
BenchmarkPingoTcpRandInt/pingo-unix-12                                     39908             35372 ns/op
BenchmarkPlugRandInt/plug-12                                              128577              9531 ns/op
BenchmarkYaegiRandInt/yaegi-12                                           1000000              1021 ns/op
BenchmarkGoloaderRandInt/goloader-12                                    180961472                6.198 ns/op
BenchmarkWazeroRandInt/wazero-12                                        11387512                98.42 ns/op

@Seb-C Seb-C marked this pull request as ready for review November 16, 2023 09:54
@uberswe uberswe added the enhancement New feature or request label Nov 16, 2023
@uberswe uberswe self-requested a review November 16, 2023 20:38
@uberswe
Copy link
Owner

uberswe commented Nov 16, 2023

I guess we need this proposal to be implemented: golang/go#42372

Doesn't look like it will happen anytime soon.

Copy link
Owner

@uberswe uberswe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like the use of tinygo but it's a good way to get around the issue of wasmexport

@uberswe uberswe merged commit 48c9f88 into uberswe:main Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants