OpcUaCanOpen
CANopen OPC-UA server
exprtk_benchmark.cpp File Reference
#include <cstdio>
#include <cmath>
#include <iostream>
#include <fstream>
#include <string>
#include <deque>
#include "exprtk.hpp"

Go to the source code of this file.

Classes

struct  native< T >
 
struct  native< T >
 

Functions

template<typename T , typename Allocator , template< typename, typename > class Sequence>
bool load_expression (exprtk::symbol_table< T > &symbol_table, Sequence< exprtk::expression< T >, Allocator > &expr_seq)
 
template<typename T >
void run_exprtk_benchmark (T &x, T &y, exprtk::expression< T > &expression, const std::string &expr_string)
 
template<typename T , typename NativeFunction >
void run_native_benchmark (T &x, T &y, NativeFunction f, const std::string &expr_string)
 
template<typename T >
bool run_parse_benchmark (exprtk::symbol_table< T > &symbol_table)
 
void pgo_primer ()
 
void perform_file_based_benchmark (const std::string &file_name, const std::size_t &rounds=100000)
 
int main (int argc, char *argv[])
 
std::size_t load_expression_file (const std::string &file_name, std::deque< std::string > &expression_list)
 

Variables

const std::string global_expression_list []
 
const std::size_t global_expression_list_size = sizeof(global_expression_list) / sizeof(std::string)
 
static const double global_lower_bound_x = -100.0
 
static const double global_lower_bound_y = -100.0
 
static const double global_upper_bound_x = +100.0
 
static const double global_upper_bound_y = +100.0
 
static const double global_delta = 0.0111
 
const double pi = 3.141592653589793238462643383279502
 

Function Documentation

◆ load_expression()

template<typename T , typename Allocator , template< typename, typename > class Sequence>
bool load_expression ( exprtk::symbol_table< T > &  symbol_table,
Sequence< exprtk::expression< T >, Allocator > &  expr_seq 
)

Definition at line 62 of file exprtk_benchmark.cpp.

◆ load_expression_file()

std::size_t load_expression_file ( const std::string &  file_name,
std::deque< std::string > &  expression_list 
)

Definition at line 399 of file exprtk_benchmark.cpp.

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 294 of file exprtk_benchmark.cpp.

◆ perform_file_based_benchmark()

void perform_file_based_benchmark ( const std::string &  file_name,
const std::size_t &  rounds = 100000 
)

Definition at line 423 of file exprtk_benchmark.cpp.

◆ pgo_primer()

void pgo_primer ( )

Definition at line 362 of file exprtk_benchmark.cpp.

◆ run_exprtk_benchmark()

template<typename T >
void run_exprtk_benchmark ( T &  x,
T &  y,
exprtk::expression< T > &  expression,
const std::string &  expr_string 
)

Definition at line 88 of file exprtk_benchmark.cpp.

◆ run_native_benchmark()

template<typename T , typename NativeFunction >
void run_native_benchmark ( T &  x,
T &  y,
NativeFunction  f,
const std::string &  expr_string 
)

Definition at line 121 of file exprtk_benchmark.cpp.

◆ run_parse_benchmark()

template<typename T >
bool run_parse_benchmark ( exprtk::symbol_table< T > &  symbol_table)

Definition at line 150 of file exprtk_benchmark.cpp.

Variable Documentation

◆ global_delta

const double global_delta = 0.0111
static

Definition at line 56 of file exprtk_benchmark.cpp.

◆ global_expression_list

const std::string global_expression_list[]
Initial value:
= {
"(y + x)",
"2 * (y + x)",
"(2 * y + 2 * x)",
"((1.23 * x^2) / y) - 123.123",
"(y + x / y) * (x - y / x)",
"x / ((x + y) + (x - y)) / y",
"1 - ((x * y) + (y / x)) - 3",
"(5.5 + x) + (2 * x - 2 / 3 * y) * (x / 3 + y / 4) + (y + 7.7)",
"1.1x^1 + 2.2y^2 - 3.3x^3 + 4.4y^15 - 5.5x^23 + 6.6y^55",
"sin(2 * x) + cos(pi / y)",
"1 - sin(2 * x) + cos(pi / y)",
"sqrt(111.111 - sin(2 * x) + cos(pi / y) / 333.333)",
"(x^2 / sin(2 * pi / y)) - x / 2",
"x + (cos(y - sin(2 / x * pi)) - sin(x - cos(2 * y / pi))) - y",
"clamp(-1.0, sin(2 * pi * x) + cos(y / 2 * pi), +1.0)",
"max(3.33, min(sqrt(1 - sin(2 * x) + cos(pi / y) / 3), 1.11))",
"if((y + (x * 2.2)) <= (x + y + 1.1), x - y, x * y) + 2 * pi / x"
}

Definition at line 30 of file exprtk_benchmark.cpp.

◆ global_expression_list_size

const std::size_t global_expression_list_size = sizeof(global_expression_list) / sizeof(std::string)

Definition at line 50 of file exprtk_benchmark.cpp.

◆ global_lower_bound_x

const double global_lower_bound_x = -100.0
static

Definition at line 52 of file exprtk_benchmark.cpp.

◆ global_lower_bound_y

const double global_lower_bound_y = -100.0
static

Definition at line 53 of file exprtk_benchmark.cpp.

◆ global_upper_bound_x

const double global_upper_bound_x = +100.0
static

Definition at line 54 of file exprtk_benchmark.cpp.

◆ global_upper_bound_y

const double global_upper_bound_y = +100.0
static

Definition at line 55 of file exprtk_benchmark.cpp.

◆ pi

const double pi = 3.141592653589793238462643383279502

Definition at line 186 of file exprtk_benchmark.cpp.