MCPcopy Create free account
hub / github.com/ArashPartow/exprtk / main

Function main

exprtk_benchmark.cpp:294–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292void perform_file_based_benchmark(const std::string& file_name, const std::size_t& rounds = 100000);
293
294int main(int argc, char* argv[])
295{
296 if (argc >= 2)
297 {
298 const std::string file_name = argv[1];
299
300 if (argc == 2)
301 perform_file_based_benchmark(file_name);
302 else
303 perform_file_based_benchmark(file_name,atoi(argv[2]));
304
305 return 0;
306 }
307
308 pgo_primer();
309
310 double x = 0;
311 double y = 0;
312
313 exprtk::symbol_table<double> symbol_table;
314 symbol_table.add_constants();
315 symbol_table.add_variable("x",x);
316 symbol_table.add_variable("y",y);
317
318 std::deque<exprtk::expression<double> > compiled_expr_list;
319
320 if (!load_expression(symbol_table,compiled_expr_list))
321 {
322 return 1;
323 }
324
325 {
326 printf("--- EXPRTK ---\n");
327 for (std::size_t i = 0; i < compiled_expr_list.size(); ++i)
328 {
329 run_exprtk_benchmark(x,y,compiled_expr_list[i],global_expression_list[i]);
330 }
331 }
332
333 {
334 printf("--- NATIVE ---\n");
335 run_native_benchmark(x, y, native<double>::func00,global_expression_list[ 0]);
336 run_native_benchmark(x, y, native<double>::func01,global_expression_list[ 1]);
337 run_native_benchmark(x, y, native<double>::func02,global_expression_list[ 2]);
338 run_native_benchmark(x, y, native<double>::func03,global_expression_list[ 3]);
339 run_native_benchmark(x, y, native<double>::func04,global_expression_list[ 4]);
340 run_native_benchmark(x, y, native<double>::func05,global_expression_list[ 5]);
341 run_native_benchmark(x, y, native<double>::func06,global_expression_list[ 6]);
342 run_native_benchmark(x, y, native<double>::func07,global_expression_list[ 7]);
343 run_native_benchmark(x, y, native<double>::func08,global_expression_list[ 8]);
344 run_native_benchmark(x, y, native<double>::func09,global_expression_list[ 9]);
345 run_native_benchmark(x, y, native<double>::func10,global_expression_list[10]);
346 run_native_benchmark(x, y, native<double>::func11,global_expression_list[11]);
347 run_native_benchmark(x, y, native<double>::func12,global_expression_list[12]);
348 run_native_benchmark(x, y, native<double>::func13,global_expression_list[13]);
349 run_native_benchmark(x, y, native<double>::func14,global_expression_list[14]);
350 run_native_benchmark(x, y, native<double>::func15,global_expression_list[15]);
351 run_native_benchmark(x, y, native<double>::func16,global_expression_list[16]);

Callers

nothing calls this directly

Calls 6

pgo_primerFunction · 0.85
load_expressionFunction · 0.85
run_exprtk_benchmarkFunction · 0.85
run_native_benchmarkFunction · 0.85
run_parse_benchmarkFunction · 0.85

Tested by

no test coverage detected