| 180 | } |
| 181 | |
| 182 | int main(int argc, char* argv[]) { |
| 183 | printf("\n\n"); |
| 184 | printf("################################################################################\n"); |
| 185 | printf("# #\n"); |
| 186 | printf("# JSON PARSER A/B BENCHMARK RESULTS #\n"); |
| 187 | printf("# #\n"); |
| 188 | printf("################################################################################\n"); |
| 189 | printf("\n"); |
| 190 | printf("Comparing:\n"); |
| 191 | printf(" • parse() - Legacy library (external dependency)\n"); |
| 192 | printf(" • parse2() - Custom native parser (zero external dependencies)\n"); |
| 193 | printf("\n"); |
| 194 | |
| 195 | const char* mode = "all"; // Default mode |
| 196 | if (argc > 1) { |
| 197 | mode = argv[1]; |
| 198 | } |
| 199 | |
| 200 | bool success = true; |
| 201 | |
| 202 | if (fl::strcmp(mode, "small") == 0) { |
| 203 | success = run_small_benchmark(); |
| 204 | } else if (fl::strcmp(mode, "large") == 0) { |
| 205 | success = run_large_benchmark(); |
| 206 | } else if (fl::strcmp(mode, "all") == 0) { |
| 207 | success = run_small_benchmark() && run_large_benchmark(); |
| 208 | |
| 209 | // Summary |
| 210 | printf("\n"); |
| 211 | printf("================================================================================\n"); |
| 212 | printf(" BENCHMARK COMPLETE \n"); |
| 213 | printf("================================================================================\n"); |
| 214 | printf("\n"); |
| 215 | printf("📊 Results show performance comparison on both small synthetic and large\n"); |
| 216 | printf(" real-world JSON datasets.\n"); |
| 217 | printf("\n"); |
| 218 | printf("🔗 Sources:\n"); |
| 219 | printf(" - Small JSON: Synthetic FastLED ScreenMap configuration\n"); |
| 220 | printf(" - Large JSON: Microsoft Edge Demos 1MB test dataset\n"); |
| 221 | printf(" https://microsoftedge.github.io/Demos/json-dummy-data/\n"); |
| 222 | printf("\n"); |
| 223 | } else if (fl::strcmp(mode, "help") == 0 || fl::strcmp(mode, "--help") == 0 || fl::strcmp(mode, "-h") == 0) { |
| 224 | print_usage(); |
| 225 | return 0; |
| 226 | } else { |
| 227 | printf("Unknown mode: %s\n\n", mode); |
| 228 | print_usage(); |
| 229 | return 1; |
| 230 | } |
| 231 | |
| 232 | return success ? 0 : 1; |
| 233 | } |
nothing calls this directly
no test coverage detected