Skip to content
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

Add wasm plugin benchmark #128

Closed
wants to merge 1 commit into from
Closed

Conversation

evacchi
Copy link
Contributor

@evacchi evacchi commented Mar 13, 2024

This refactors _examples/15_cel_plugin so that it can be run both as a test and as a benchmark and adds a flag to WasmConfig to disable/enable debug logging. The benchmark disables all logging to avoid interfering with the benchmark results. I have also updated the Makefiles to run this benchmark with make bench.

I have also added a new test case (testRegexComplexSuccess) to evaluate a slightly more involved regex.

The results are encouraging, even if this test is probably dominated by I/O. The following are the results of the baseline compared to the latest pre-release (#124).

                              │   before.txt    │                after.txt                │
                              │     sec/op      │     sec/op       vs base                │
Federation/success-10           0.0005831n ± 6%   0.0005571n ± 7%   -4.48% (p=0.032 n=20)
Federation/success_complex-10   0.0005713n ± 5%   0.0005227n ± 8%   -8.51% (p=0.000 n=20)
Federation/failure-10           0.0003323n ± 5%   0.0002961n ± 8%  -10.90% (p=0.000 n=20)
geomean                         0.0004802n        0.0004417n        -8.00%

Showing an improvement between 4 and 10% at run-time. Let me know if the approach to configuration works for you, and if the refactoring of the test is fine. I mostly just cobbled this together to make get the results quickly!

Please notice that this PR does not concern _examples/16_code_gen_plugin.

This refactors `_examples/15_cel_plugin` so that it can be run both as a test
and as a benchmark and adds a flag to `WasmConfig` to disable/enable debug logging.
The benchmark disables all logging to avoid interfering with the benchmark results.
I have also updated the Makefiles to run this benchmark with `make bench`.

I have also added a new test case (`testRegexComplexSuccess`) to evaluate
a slightly more involved regex.

The results are encouraging, even if this test is probably dominated by I/O.
The following are the results of the baseline compared to the latest
pre-release (mercari#124).

```
                              │   before.txt    │                after.txt                │
                              │     sec/op      │     sec/op       vs base                │
Federation/success-10           0.0005831n ± 6%   0.0005571n ± 7%   -4.48% (p=0.032 n=20)
Federation/success_complex-10   0.0005713n ± 5%   0.0005227n ± 8%   -8.51% (p=0.000 n=20)
Federation/failure-10           0.0003323n ± 5%   0.0002961n ± 8%  -10.90% (p=0.000 n=20)
geomean                         0.0004802n        0.0004417n        -8.00%
```

Showing an improvement between 4 and 10% at run-time. Let me know
if the approach to configuration works for you, and if the refactoring
of the test is fine. I mostly just cobbled this together to make get
the results quickly!

Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
@goccy
Copy link
Member

goccy commented Apr 17, 2024

Thank you for your contribution ! We added an example for profiling of the wasm plugin ( 18_load ) , so I close this.

@goccy goccy closed this Apr 17, 2024
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.

2 participants