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

Implement microbenchmark #1022

Merged
merged 1 commit into from
Aug 16, 2023
Merged

Implement microbenchmark #1022

merged 1 commit into from
Aug 16, 2023

Conversation

fhanau
Copy link
Collaborator

@fhanau fhanau commented Aug 16, 2023

Implements a microbenchmark based on google/microbenchmark. This includes bazel integration for the library, defining the wd_cc_benchmark() target rule and adding an example benchmark.
There is also a header with convenience macros for benchmarking, including WD_BENCH() which is not yet used but can serve as a drop-in replacement for KJ_TEST() to make it easy to benchmark many of our existing tests. The felix/microbench-poc branch expands on this, but contains more experimental work; this PR is intended to land the microbenchmark and allow developers to define simple benchmarks, use bazel run //src/workerd/tests:bench-json to check it out!

@fhanau fhanau requested review from ohodson and vickykont August 16, 2023 01:02

namespace workerd::microbench {

} // namespace workerd::api::microbench
Copy link
Contributor

Choose a reason for hiding this comment

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

The namespace on L31 doesn't align with L29, but neither is likely necessary in this PR. JFYI, most of the files in workerd/test just emit their bits in the workerd namespace.

@ohodson
Copy link
Contributor

ohodson commented Aug 16, 2023

It'd be good to have the benchmark repro step in the commit message and the ticket, just to provide some initial context for anyone who wants it in future.

Adds a simple interface for defining microbenchmarks, use
`bazel run //src/workerd/tests:bench-json` to run the provided example
benchmark.
@fhanau fhanau force-pushed the felix/microbench-v1 branch from a8ad9c4 to 1dfb318 Compare August 16, 2023 13:26
@fhanau
Copy link
Collaborator Author

fhanau commented Aug 16, 2023

Thanks for the quick review! I removed the namespace for the time being and added the bazel command as suggested.

@fhanau fhanau merged commit a4f075a into main Aug 16, 2023
@fhanau fhanau deleted the felix/microbench-v1 branch August 16, 2023 14:10
@kentonv
Copy link
Member

kentonv commented Aug 16, 2023

FWIW KJ_TEST already has some benchmark functionality built in, see http-over-capnp-perf-test.c++ in the capnp repo for an example.

I'm sure Google's thing has a lot more features though.

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.

3 participants