From 6e66cc2669cbb463f184ef0e242f66278434f115 Mon Sep 17 00:00:00 2001 From: Richard Palethorpe Date: Tue, 10 Dec 2024 09:07:41 +0000 Subject: [PATCH] sheet: Set read buffer size to 2MB for index and transformation This reduces the indexing time by 3-4x on a 13GB file with a Ryzen 7 6800U. --- app/sheet/index.c | 1 + app/sheet/transformation.c | 1 + 2 files changed, 2 insertions(+) diff --git a/app/sheet/index.c b/app/sheet/index.c index 98a2eb96..1e29ac54 100644 --- a/app/sheet/index.c +++ b/app/sheet/index.c @@ -34,6 +34,7 @@ enum zsv_index_status build_memory_index(struct zsvsheet_index_opts *optsp) { ix_zopts.ctx = &ixr; ix_zopts.row_handler = build_memory_index_row_handler; + ix_zopts.buffsize = 2 * 1024 * 1024; enum zsv_status zst = zsv_new_with_properties(&ix_zopts, optsp->custom_prop_handler, optsp->filename, &ixr.parser); if (zst != zsv_status_ok) diff --git a/app/sheet/transformation.c b/app/sheet/transformation.c index 0d65d20f..0b654ccd 100644 --- a/app/sheet/transformation.c +++ b/app/sheet/transformation.c @@ -205,6 +205,7 @@ enum zsvsheet_status zsvsheet_push_transformation(zsvsheet_proc_context_t ctx, zopts.ctx = opts.user_context; zopts.row_handler = (void (*)(void *))opts.row_handler; zopts.stream = fopen(filename, "rb"); + zopts.buffsize = 2 * 1024 * 1024; if (!zopts.stream) goto error;