Stream: git-wasmtime

Topic: wasmtime / PR #15188 bench: Measure benches with Callgrin...


view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:12):

adamrk opened PR #15188 from adamrk:abk/bench-callgrind to bytecodealliance:main:

Allow benchmarks to be measured by running under Callgrind. This is done by providing a utilities wasmtime_bench_util::bench and wasmtime_bench_util::Timer which are drop-in replacements for criterion::Bencher::iter and std::time::Instant respectively.

The goal of this change is to allow tracking of benchmark results in are-we-fast-yet.

When run natively, the utility replacements behave the same as iter and Instant, but when running under Callgrind they'll dump Valgrind counters when the timer is stopped.

Additionally, a helper function is provided which can be used to detect if the benchmark is being run under Valgrind and this is used for some benchmarks to reduce their memory usage to an amount Valgrind can support.

When using Valgrind, benchmarks should be run with Criterion's --test mode, so that each benchmark produces a single dump:

    valgrind --tool=callgrind --instr-atstart=no \
      target/release/deps/<bench> --bench --test

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.md

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:12):

adamrk removed the review request for wasmtime-wasi-reviewers from PR #15188.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:12):

adamrk requested wasmtime-wasi-reviewers for a review on PR #15188.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:12):

adamrk requested rvolosatovs for a review on PR #15188.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:12):

adamrk removed the review request for wasmtime-core-reviewers from PR #15188.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:12):

adamrk requested dicej for a review on PR #15188.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:12):

adamrk requested wasmtime-core-reviewers for a review on PR #15188.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:12):

adamrk removed the review request for wasmtime-default-reviewers from PR #15188.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:12):

adamrk requested wasmtime-default-reviewers for a review on PR #15188.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:12):

adamrk requested alexcrichton for a review on PR #15188.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:17):

:memo: adamrk submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:17):

:speech_balloon: adamrk created PR review comment:

This dependency is already used in Sightglass, but it pulls in a few dependencies which don't pass cargo vet yet. I marked the new bench util crate as only needing safe-to-run, but I'm not sure exactly what the process should be for marking these new crates as safe-to-run.

Alternatively, we could not use valgrind-requests and just implement what we need directly. I think that would be about 60 lines of code where were copying constants from valgrind header files, as well as inline assembly to clear and dump the counters.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 19:20):

adamrk updated PR #15188.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 06 2026 at 21:26):

adamrk updated PR #15188.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 09 2026 at 14:45):

alexcrichton commented on PR #15188:

What's the consequence of forgetting this? Given that we have to go out of our way to integrate this seems like any new benchmarks are more-or-less guaranteed to forget this so I'm curious what would happen in that case. Overall looks fine to me, and new dev-deps IMO are fine.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 09 2026 at 14:56):

adamrk commented on PR #15188:

What's the consequence of forgetting this?

If someone creates a benchmark that uses std::time::Instant or the criterion iter then I think we should be able to set up are-we-fast-yet to see that there's no dump for that benchmark and show it as an error (or just 0).

view this post on Zulip Wasmtime GitHub notifications bot (Nov 09 2026 at 21:08):

:memo: fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 09 2026 at 21:08):

:speech_balloon: fitzgen created PR review comment:

This dependency is already used in Sightglass, but it pulls in a few dependencies which don't pass cargo vet yet. I marked the new bench util crate as only needing safe-to-run, but I'm not sure exactly what the process should be for marking these new crates as safe-to-run.

I think it is fine to mark as safe-to-run since it is a developer dependency only, not a deployment dependency.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 17:26):

adamrk updated PR #15188.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 17:38):

adamrk updated PR #15188.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 13 2026 at 17:38):

adamrk requested fitzgen for a review on PR #15188.


Last updated: Nov 19 2026 at 20:05 UTC