Skip to content

Commit

Permalink
sheet: Set read buffer size to 2MB for index and transformation
Browse files Browse the repository at this point in the history
This reduces the indexing time by 3-4x on a 13GB file with a Ryzen 7 6800U.
  • Loading branch information
richiejp committed Dec 10, 2024
1 parent 813f29b commit 6e66cc2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/sheet/index.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions app/sheet/transformation.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6e66cc2

Please sign in to comment.