1 // Copyright 2004-present Facebook. All rights reserved.
2 #include "folly/test/function_benchmark/benchmark_impl.h"
4 #include "folly/test/function_benchmark/test_functions.h"
7 * These functions are defined in a separate file so that gcc won't be able to
8 * inline them and optimize away the indirect calls.
11 void BM_fn_ptr_invoke_impl(int iters, void (*fn)()) {
12 for (int n = 0; n < iters; ++n) {
17 void BM_std_function_invoke_impl(int iters,
18 const std::function<void()>& fn) {
19 for (int n = 0; n < iters; ++n) {
24 void BM_mem_fn_invoke_impl(int iters,
26 void (TestClass::*memfn)()) {
27 for (int n = 0; n < iters; ++n) {
32 void BM_virtual_fn_invoke_impl(int iters, VirtualClass* vc) {
33 for (int n = 0; n < iters; ++n) {