#include #include #include #include #include #include "utils.h" #include "file-scanner.h" int main (void) { // const char *filename = "./res/users_data.csv"; const char *filename = "./res/transactions_data.csv"; int fd = open (filename, O_RDONLY); if (0) { MEASURE_SCOPE ("mmap"); struct string_view sv = mmap_whole (fd); struct scanner sc; scanner__init (&sc, sv); while (!scanner__reached_end (&sc)) { static size_t i = 0; struct string_view sv = scanner__get_until (&sc, '\n'); sc.cursor += 1; // if (i > 13300000) // printf ("%s:%lu: " STRING_VIEW__FMT "\n", filename, ++i, STRING_VIEW__FMTA (sv)); i += 1; if (i > 13300000) break; } munmap (&sv.begin, STRING_VIEW__LENGTH (sv)); } if (1) { MEASURE_SCOPE ("io_uring"); struct file_scanner fs; file_scanner__init (&fs, fd); while (!file_scanner__reached_end (&fs)) { static size_t i = 0; struct string_view sv = file_scanner__get_until (&fs, '\n'); file_scanner__skip_n (&fs, 1); // if (i > 13300000) // printf ("%s:%lu: %lX/%lX/%lX " STRING_VIEW__FMT "\n", filename, i, // fs.input_scanned, fs.input_submitted, fs.input_size, // STRING_VIEW__FMTA (sv)); i += 1; if (i > 13300000) break; } file_scanner__deinit (&fs); } close (fd); return EXIT_SUCCESS; }