| 1083 | } |
| 1084 | |
| 1085 | int |
| 1086 | main( |
| 1087 | int const argc, |
| 1088 | char const* const* const argv) |
| 1089 | { |
| 1090 | if( argc < 2 ) |
| 1091 | { |
| 1092 | std::cerr << |
| 1093 | "Usage: bench [options...] <file>...\n" |
| 1094 | "\n" |
| 1095 | "Options: -t:[p][s] Test parsing, serialization or both\n" |
| 1096 | " (default both)\n" |
| 1097 | " -i:[b][u][s][o][d][r][n] Test the specified implementations\n" |
| 1098 | " (b: Boost.JSON)\n" |
| 1099 | " (u: Boost.JSON, null parser)\n" |
| 1100 | " (s: Boost.JSON, convenient functions)\n" |
| 1101 | " (o: Boost.JSON, stream operators)\n" |
| 1102 | #ifdef BOOST_JSON_HAS_RAPIDJSON |
| 1103 | " (r: RapidJSON)\n" |
| 1104 | #endif // BOOST_JSON_HAS_RAPIDJSON |
| 1105 | #ifdef BOOST_JSON_HAS_NLOHMANN_JSON |
| 1106 | " (n: nlohmann/json)\n" |
| 1107 | #endif // BOOST_JSON_HAS_NLOHMANN_JSON |
| 1108 | " (default all)\n" |
| 1109 | " -a:[p][d] Memory allocation strategy\n" |
| 1110 | " (p: memory pool)\n" |
| 1111 | " (d: default strategy)\n" |
| 1112 | " (default memory pool)\n" |
| 1113 | " -n:<number> Number of trials (default 6)\n" |
| 1114 | " -b:<branch> Branch label for boost implementations\n" |
| 1115 | " -m:[i][p][n] Number parsing mode\n" |
| 1116 | " (i: imprecise)\n" |
| 1117 | " (p: precise)\n" |
| 1118 | " (n: none)\n" |
| 1119 | " (default imprecise)\n" |
| 1120 | " -f:[y][n] Include file IO into consideration when testing parsers\n" |
| 1121 | " (y: yes)\n" |
| 1122 | " (n: no)\n" |
| 1123 | " (default no)\n" |
| 1124 | ; |
| 1125 | |
| 1126 | return 4; |
| 1127 | } |
| 1128 | |
| 1129 | file_list vf; |
| 1130 | |
| 1131 | for( int i = 1; i < argc; ++i ) |
| 1132 | { |
| 1133 | char const* s = argv[ i ]; |
| 1134 | |
| 1135 | if( *s == '-' ) |
| 1136 | { |
| 1137 | if( !parse_option( s+1 ) ) |
| 1138 | std::cerr << "Unrecognized or incorrect option: '" << s << "'\n"; |
| 1139 | } |
| 1140 | else |
| 1141 | { |
| 1142 | vf.emplace_back( file_item{ argv[i], load_file( s ) } ); |