@@ -28,7 +28,7 @@ using Benchmarks::BenchArgs;
2828
2929template <arithmetic_float T>
3030void evaluateProperties (const std::vector<T> &lines,
31- const std::array<BenchArgs<T>, Benchmarks::COUNT> &args) {
31+ const std::array<BenchArgs<T>, Benchmarks::COUNT> &args, const std::string& filter = " " ) {
3232 constexpr auto precision = std::numeric_limits<T>::digits10;
3333 fmt::println (" {:20} {:20}" , " Algorithm" , " Valid round-trip" );
3434
@@ -37,7 +37,11 @@ void evaluateProperties(const std::vector<T> &lines,
3737 std::cout << " # skipping " << algo.name << std::endl;
3838 continue ;
3939 }
40-
40+ // Apply filter if provided
41+ if (!filter.empty () && std::string (algo.name ).find (filter) == std::string::npos) {
42+ std::cout << " # filtered out " << algo.name << std::endl;
43+ continue ;
44+ }
4145 char buf1[100 ], buf2[100 ];
4246 std::span<char > bufRef (buf1, sizeof (buf1)), bufAlgo (buf2, sizeof (buf2));
4347 int incorrect = 0 ;
@@ -69,12 +73,17 @@ void evaluateProperties(const std::vector<T> &lines,
6973
7074template <arithmetic_float T>
7175void process (const std::vector<T> &lines,
72- const std::array<BenchArgs<T>, Benchmarks::COUNT> &args) {
76+ const std::array<BenchArgs<T>, Benchmarks::COUNT> &args, const std::string& filter = " " ) {
7377 for (const auto &algo : args) {
7478 if (!algo.used ) {
7579 std::cout << " # skipping " << algo.name << std::endl;
7680 continue ;
7781 }
82+ // Apply filter if provided
83+ if (!filter.empty () && std::string (algo.name ).find (filter) == std::string::npos) {
84+ std::cout << " # filtered out " << algo.name << std::endl;
85+ continue ;
86+ }
7887 pretty_print (lines, algo.name , [&algo](const std::vector<T> &lines) -> int {
7988 int volume = 0 ;
8089 char buf[100 ];
@@ -146,6 +155,8 @@ int main(int argc, char **argv) {
146155 cxxopts::value<bool >()->default_value (" false" ))
147156 (" e,errol" , " Enable errol3 (current impl. returns invalid values, e.g., for 0)." ,
148157 cxxopts::value<bool >()->default_value (" false" ))
158+ (" a,algo-filter" , " Filter algorithms by name substring." ,
159+ cxxopts::value<std::string>()->default_value (" " ))
149160 (" h,help" , " Print usage." );
150161 const auto result = options.parse (argc, argv);
151162
@@ -155,6 +166,7 @@ int main(int argc, char **argv) {
155166 }
156167
157168 const bool single = result[" single" ].as <bool >();
169+ const std::string filter = result[" algo-filter" ].as <std::string>();
158170 std::cout << " number type: binary"
159171 << (single ? " 32 (float)" : " 64 (double)" ) << std::endl;
160172
@@ -187,14 +199,14 @@ int main(int argc, char **argv) {
187199 algorithms = Benchmarks::initArgs<double >(errol);
188200
189201 const bool test = result[" test" ].as <bool >();
190- std::visit ([test](const auto &lines, const auto &args) {
202+ std::visit ([test,&filter ](const auto &lines, const auto &args) {
191203 using T1 = typename std::decay_t <decltype (lines)>::value_type;
192204 using T2 = typename std::decay_t <decltype (args)>::value_type::Type;
193205 if constexpr (std::is_same_v<T1, T2>) {
194206 if (test)
195- evaluateProperties (lines, args);
207+ evaluateProperties (lines, args, filter );
196208 else
197- process (lines, args);
209+ process (lines, args, filter );
198210 }
199211 }, numbers, algorithms);
200212 } catch (const std::exception &e) {
0 commit comments