From 776276d5c7e67356a880f3e31076d32cdc1c1882 Mon Sep 17 00:00:00 2001 From: Martin Michalec Date: Tue, 10 Nov 2026 11:29:58 +0300 Subject: publish --- src/sandbox.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/sandbox.c (limited to 'src/sandbox.c') diff --git a/src/sandbox.c b/src/sandbox.c new file mode 100644 index 0000000..957d318 --- /dev/null +++ b/src/sandbox.c @@ -0,0 +1,55 @@ +#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; +} -- cgit v1.3.1