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

Function run_parse_benchmark

exprtk_benchmark.cpp:150–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148
149template <typename T>
150bool run_parse_benchmark(exprtk::symbol_table<T>& symbol_table)
151{
152 static const std::size_t rounds = 100000;
153 exprtk::parser<double> parser;
154 exprtk::expression<double> expression;
155
156 expression.register_symbol_table(symbol_table);
157
158 for (std::size_t i = 0; i < global_expression_list_size; ++i)
159 {
160 exprtk::timer timer;
161 timer.start();
162
163 for (std::size_t r = 0; r < rounds; ++r)
164 {
165 if (!parser.compile(global_expression_list[i],expression))
166 {
167 printf("[run_parse_benchmark] - Parser Error: %s\tExpression: %s\n",
168 parser.error().c_str(),
169 global_expression_list[i].c_str());
170
171 return false;
172 }
173 }
174
175 timer.stop();
176
177 printf("[parse] Total Time:%12.8f Rate:%14.3fparse/sec Expression: %s\n",
178 timer.time(),
179 rounds / timer.time(),
180 global_expression_list[i].c_str());
181 }
182
183 return true;
184}
185
186const double pi = 3.141592653589793238462643383279502;
187

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected