Lumiera  0.pre.03
»edit your freedom«
microbenchmark-adaptor.hpp File Reference

Go to the source code of this file.

Description

Helpers and wrappers so simplify usage of micobenchmark.hpp.

Notably the benchmark functions expect the actual »test subject« as a function or lambda with signature size_t(size_t). The argument will be the loop index and the result value will be added into a checksum, which also ensures that the optimiser can not unroll the benchmark loop. However, in practical use this strict requirement for the signature turned out as a nuisance; this header provides some automatic adaption

  • accept any numeric type as argument
  • accept any numeric type as checksum contribution (cast to size_t)
  • accept signature void(void)

Definition in file microbenchmark-adaptor.hpp.

Classes

struct  Adaptor< SIG, SEL >
 
struct  Adaptor< ON(IN), enable_if< __and_< is_arithmetic< IN >, __not_< is_same< IN, size_t > >, is_arithmetic< ON >, __not_< is_same< ON, size_t > > > > >
 
struct  Adaptor< ON(void), enable_if< __and_< is_arithmetic< ON >, __not_< is_same< ON, size_t > > > > >
 
struct  Adaptor< size_t(size_t)>
 
struct  Adaptor< void(IN), enable_if< __and_< is_arithmetic< IN >, __not_< is_same< IN, size_t > > > > >
 
struct  Adaptor< void(void)>
 

Functions

template<typename FUN >
decltype(auto) adapted4benchmark (FUN &&fun)
 Adapter to expose the signature size_t(size_t) from any suitable source functor or lambda. More...
 

Namespaces

 lib
 Implementation namespace for support and library code.
 

Function Documentation

◆ adapted4benchmark()

decltype(auto) lib::test::microbenchmark::adapted4benchmark ( FUN &&  fun)
inline

Adapter to expose the signature size_t(size_t) from any suitable source functor or lambda.

Note
requirements
  • arity must be either zero or one argument
  • if argument or return type are present, they must be plain arithmetic types
  • no references allowed
  • can be void(void)

Definition at line 158 of file microbenchmark-adaptor.hpp.