From 7d956c533e9fd7d3bbb9a4a8b7f89f0fe54d4bc3 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Sun, 13 Apr 2025 22:43:46 +0200 Subject: first draft --- csv-perf.c | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 csv-perf.c (limited to 'csv-perf.c') diff --git a/csv-perf.c b/csv-perf.c deleted file mode 100644 index 1c0f7a3..0000000 --- a/csv-perf.c +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include -#include -#include - -#include "csv.h" - -static int -test(FILE *f) -{ - int line = 0; - csv_t csv = { 0 }; - - while ( csv_read(&csv, f) ) { - ++line; - } - - return line; -} - -int -main(int argc, char *argv[]) -{ - if ( argc != 2 ) { - fprintf(stderr, "usage: %s testfile\n", argv[0]); - return EXIT_FAILURE; - } - - FILE *in = fopen(argv[1], "r"); - if ( in == NULL ) { - fprintf(stderr, "failed to open testfile...\n"); - return EXIT_FAILURE; - } - - clock_t start = clock(); - - int lines = test(in); - - clock_t end = clock(); - - fclose(in); - - printf("%d lines processed, duration: %.3lf sec\n", lines, ((double) (end - start)) / CLOCKS_PER_SEC); - - return EXIT_SUCCESS; -} -- cgit v1.3