mirror of
https://github.com/apple/foundationdb.git
synced 2026-01-25 04:18:18 +00:00
* Use Findbenchmark instead of hardcoding the google-benchmark path in flowbench * fixup! Add missing include directories * fixup! Remove extra PRIVATE token * target_link_libraries -> target_include_directories * Support downloading google-benchmark if not found locally This may need to be reconsidered, as it seems more reasonable that the developer prepares the library rather than letting CMake takes the responsibility of monitoring the availability of an external project. * Remove extra creation of flowbench target
Summary
flowbench is an executable that can be used to microbenchmark parts of the FoundationDB code. The goal is to make it easy to test the performance of various sub-millisecond operations using flow and fdbrpc. Specifically, this tool can be used to:
- Test the performance effects of changes to the actor compiler or to the
flowandfdbrpclibraries - Test the performance of various uses of the
flowandfdbrpclibraries - Find areas for improvement in the
flowandfdbrpclibraries - Compare
flow/fdbrpcprimitives to alternatives provided by the standard library or other third-party libraries.
Usage
- To build the
flowbenchexecutable, runninja flowbenchormake flowbenchdepending on which build system you're using. - Then you can run
bin/flowbench --helpto see possible uses offlowbench. - Running
bin/flowbenchdirectly will run all registered benchmarks, but you may want to limit your run to a subset of benchmarks. This can be done by runningbin/flowbench --benchmark_filter=<regex> - All benchmark names can be listed with
bin/flowbench --benchmark_list_tests - Example output:
$ bin/flowbench --benchmark_filter=bench_ref
2020-08-04 21:49:40
Running bin/flowbench
Run on (7 X 2904 MHz CPU s)
CPU Caches:
L1 Data 32 KiB (x7)
L1 Instruction 32 KiB (x7)
L2 Unified 256 KiB (x7)
L3 Unified 12288 KiB (x1)
Load Average: 0.15, 0.15, 0.72
---------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
---------------------------------------------------------------------------------------------------------------
bench_ref_create_and_destroy<RefType::RawPointer> 4.90 ns 4.90 ns 116822124 items_per_second=203.88M/s
bench_ref_create_and_destroy<RefType::UniquePointer> 4.94 ns 4.94 ns 141101924 items_per_second=202.555M/s
bench_ref_create_and_destroy<RefType::SharedPointer> 42.5 ns 42.5 ns 13802909 items_per_second=23.531M/s
bench_ref_create_and_destroy<RefType::FlowReference> 5.05 ns 5.05 ns 100000000 items_per_second=197.955M/s
bench_ref_copy<RefType::RawPointer> 1.15 ns 1.15 ns 612121585 items_per_second=871.218M/s
bench_ref_copy<RefType::SharedPointer> 10.0 ns 10.0 ns 67553102 items_per_second=99.8113M/s
bench_ref_copy<RefType::FlowReference> 2.33 ns 2.33 ns 292317474 items_per_second=428.507M/s
- More detailed documentation can be found at https://github.com/google/benchmark
Existing Benchmarks
bench_populatemeasures the population of a vector of mutationsbench_refcompares the performance of theflowReferencetype to other pointer typesbench_iteratemeasures iteration over a list of mutationsbench_streammeasures the performance of writing to and reading from aPromiseStreambench_randommeasures the performance ofDeterministicRandom.bench_timermeasures the performance of FoundationDB timers.
Future use cases
- Benchmark the overhead of sending and receiving messages through
FlowTransport - Benchmark the performance of serializing/deserializing various types