*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
BENCHMARK(scope_guard_std_function, iters) {
std::function<void()> fn(doNothing);
for (size_t n = 0; n < iters; ++n) {
BENCHMARK(scope_guard_std_function, iters) {
std::function<void()> fn(doNothing);
for (size_t n = 0; n < iters; ++n) {
// but create the ScopeGuard with an rvalue to a std::function
BENCHMARK(scope_guard_std_function_rvalue, iters) {
for (size_t n = 0; n < iters; ++n) {
// but create the ScopeGuard with an rvalue to a std::function
BENCHMARK(scope_guard_std_function_rvalue, iters) {
for (size_t n = 0; n < iters; ++n) {
// but create the ScopeGuard with an rvalue to a folly::Function
BENCHMARK(scope_guard_Function_rvalue, iters) {
for (size_t n = 0; n < iters; ++n) {
// but create the ScopeGuard with an rvalue to a folly::Function
BENCHMARK(scope_guard_Function_rvalue, iters) {
for (size_t n = 0; n < iters; ++n) {
}
}
// Using ScopeGuard to invoke a function pointer
BENCHMARK(scope_guard_fn_ptr, iters) {
for (size_t n = 0; n < iters; ++n) {
}
}
// Using ScopeGuard to invoke a function pointer
BENCHMARK(scope_guard_fn_ptr, iters) {
for (size_t n = 0; n < iters; ++n) {
}
}
// Using ScopeGuard to invoke a lambda that does nothing
BENCHMARK(scope_guard_lambda_noop, iters) {
for (size_t n = 0; n < iters; ++n) {
}
}
// Using ScopeGuard to invoke a lambda that does nothing
BENCHMARK(scope_guard_lambda_noop, iters) {
for (size_t n = 0; n < iters; ++n) {
}
}
// Using ScopeGuard to invoke a lambda that invokes a function
BENCHMARK(scope_guard_lambda_function, iters) {
for (size_t n = 0; n < iters; ++n) {
}
}
// Using ScopeGuard to invoke a lambda that invokes a function
BENCHMARK(scope_guard_lambda_function, iters) {
for (size_t n = 0; n < iters; ++n) {
BENCHMARK(scope_guard_lambda_local_var, iters) {
uint32_t count = 0;
for (size_t n = 0; n < iters; ++n) {
BENCHMARK(scope_guard_lambda_local_var, iters) {
uint32_t count = 0;
for (size_t n = 0; n < iters; ++n) {
// Increment count if n is odd. Without this conditional check
// (i.e., if we just increment count each time through the loop),
// gcc is smart enough to optimize the entire loop away, and just set
// Increment count if n is odd. Without this conditional check
// (i.e., if we just increment count each time through the loop),
// gcc is smart enough to optimize the entire loop away, and just set