@@ -43,9 +43,10 @@ struct diy_float_t {
4343template <arithmetic_float T>
4444void process (const std::vector<TestCase<T>> &lines,
4545 const std::vector<BenchArgs<T>> &args,
46- const std::vector<std::string> &algo_filter) {
46+ const std::vector<std::string> &algo_filter,
47+ bool string_eval) {
4748 // We have a special algorithm for the string generation:
48- if (!algo_filtered_out (" just_string" , algo_filter)) {
49+ if (string_eval && !algo_filtered_out (" just_string" , algo_filter)) {
4950 std::vector<diy_float_t > parsed;
5051 for (const auto d : lines) {
5152 const auto v = jkj::grisu_exact (d.value );
@@ -153,6 +154,8 @@ int main(int argc, char **argv) {
153154 cxxopts::value<std::string>()->default_value (" uniform" ))
154155 (" s,single" , " Use single precision instead of double." ,
155156 cxxopts::value<bool >()->default_value (" false" ))
157+ (" S,string-eval" , " Evaluate perf. of string generation from decimal mantissa/exponent" ,
158+ cxxopts::value<bool >()->default_value (" false" ))
156159 (" t,test" , " Test the algorithms and find their properties." ,
157160 cxxopts::value<bool >()->default_value (" false" ))
158161 (" e,errol" , " Enable errol3 (current impl. returns invalid values, e.g., for 0)." ,
@@ -204,14 +207,15 @@ int main(int argc, char **argv) {
204207 algorithms = initArgs<double >(errol, repeat, fixed_size);
205208
206209 const bool test = result[" test" ].as <bool >();
207- std::visit ([test, &filter](const auto &lines, const auto &args) {
210+ const bool string_eval = result[" string-eval" ].as <bool >();
211+ std::visit ([test, string_eval, &filter](const auto &lines, const auto &args) {
208212 using T1 = typename std::decay_t <decltype (lines)>::value_type::Type;
209213 using T2 = typename std::decay_t <decltype (args)>::value_type::Type;
210214 if constexpr (std::is_same_v<T1, T2>) {
211215 if (test)
212216 evaluateProperties (lines, args, filter);
213217 else
214- process (lines, args, filter);
218+ process (lines, args, filter, string_eval );
215219 }
216220 }, numbers, algorithms);
217221 } catch (const std::exception &e) {
0 commit comments