csvlite benchmarks

How fast is csvlite on a 10 GB file?

We ran each test ten times with a warm cache and ten times with a cold cache, using the same five files from 1 MB to 10 GB. The tables report full elapsed time, including opening the file.

Results at a glance

4.05 / 5.82 sto open and index 10 GB, warm / cold
5.55 / 6.79 sto open and filter 10 GB for a text value
7.93 / 8.21 sto open and sort 52.7 million rows by date
1,800 runsten per operation, size, and cache state

Test machine and files

The test machine runs Linux on an 11th Gen Intel Core i7-11850H with 8 cores, 16 threads, 31.1 GiB of RAM, and an NVMe SSD. We tested a release build of csvlite 0.1.0.

All five files use the same generated 15-column schema, with integer, decimal, date, text, and boolean fields. One percent of the values are invalid and two percent are empty. A fixed seed makes the files reproducible byte for byte.

FileBytesRowsSHA-256
1 MB999,8375,45222a2f228a339
10 MB9,999,91253,5966a7e28ed112b
100 MB99,999,911532,923fb052e3d47fe
1 GB999,999,9575,300,2050f8da3f8cec6
10 GB9,999,999,80952,720,4164719e88857cc

Before every warm-cache trial, the runner reads the entire source file into the page cache. Before every cold-cache trial, it asks Linux to evict that file with POSIX_FADV_DONTNEED. Cache state is controlled per trial rather than inferred from the order of the runs.

What the clock measures. These are engine benchmarks. A headless test program calls the same indexing, filtering, sorting, and grouping code as the desktop app. Each filter, sort, and group trial starts a new process, opens the file, performs the operation, and stops when the result is complete in memory. Drawing the result on screen is not included.

Operations

Each cell shows the median warm-cache time followed by the median cold-cache time. Both medians come from ten trials. The small-file figures include process startup, which is why several round to the same millisecond.

Operation1 MB10 MB100 MB1 GB10 GB
Rows5,45253,596532,9235,300,20552,720,416
Open and index5 / 7 ms9 / 13 ms17 / 49 ms189 / 464 ms4.05 / 5.82 s
Filter, text equals6 / 7 ms7 / 14 ms23 / 52 ms248 / 492 ms5.55 / 6.79 s
Filter, regular expression7 / 9 ms13 / 19 ms62 / 73 ms492 / 760 ms7.92 / 8.73 s
Filter, numeric range5 / 8 ms9 / 15 ms32 / 62 ms358 / 595 ms6.70 / 7.73 s
Filter, invalid numbers6 / 7 ms8 / 16 ms27 / 56 ms293 / 569 ms5.77 / 7.59 s
Filter, date range6 / 7 ms9 / 16 ms29 / 57 ms333 / 564 ms5.83 / 7.93 s
Filter, invalid dates6 / 7 ms8 / 17 ms25 / 58 ms322 / 550 ms5.86 / 6.98 s
Sort, text column7 / 7 ms9 / 15 ms43 / 68 ms455 / 678 ms10.57 / 10.25 s
Sort, numeric column6 / 7 ms8 / 15 ms52 / 68 ms451 / 663 ms7.90 / 8.27 s
Sort, date column6 / 8 ms10 / 16 ms42 / 68 ms416 / 650 ms7.93 / 8.21 s

Range of the 10 GB results

Each cell shows the median followed by the fastest and slowest of the ten trials.

OperationWarm: median (min–max)Cold: median (min–max)
Open and index4.05 s (3.69–5.33)5.82 s (5.59–6.57)
Filter, text equals5.55 s (4.42–7.24)6.79 s (5.94–7.70)
Filter, regular expression7.92 s (7.14–8.44)8.73 s (8.24–9.32)
Filter, numeric range6.70 s (6.39–7.98)7.73 s (7.39–8.40)
Filter, invalid numbers5.77 s (5.45–7.24)7.59 s (7.30–7.91)
Filter, date range5.83 s (5.48–7.08)7.93 s (7.18–8.44)
Filter, invalid dates5.86 s (5.39–6.78)6.98 s (6.25–7.72)
Sort, text column10.57 s (9.86–11.13)10.25 s (10.00–10.90)
Sort, numeric column7.90 s (7.18–8.46)8.27 s (7.98–8.54)
Sort, date column7.93 s (7.25–8.68)8.21 s (7.60–8.64)
Group by 8 keys6.04 s (5.45–7.64)7.41 s (6.61–7.80)
Group by 56 keys6.98 s (6.35–8.40)8.37 s (7.49–8.55)
Group by 3,654 keys7.39 s (6.58–8.11)8.76 s (8.06–8.93)
Distinct count, 22 values7.59 s (7.04–8.68)8.88 s (8.54–9.51)

Warm and cold results overlap in a few CPU-heavy cases, such as the text sort. That is ordinary run-to-run variation: cache control changes how the file is read, but it does not remove scheduling and CPU-frequency noise after the file is open.

Grouping

csvlite calculates grouped results exactly. If a grouping would use too much memory, it stops and reports the limit it reached instead of returning an estimate. Those limits depend on the number of distinct keys and values, not directly on file size.

Number of group keys

Each test calculates a count and a sum. Only the number of distinct group keys changes. As above, times are warm / cold medians and include opening the file.

Group byDistinct keys1 MB10 MB100 MB1 GB10 GB
Region86 / 8 ms12 / 16 ms34 / 62 ms376 / 615 ms6.04 / 7.41 s
Region + status566 / 8 ms11 / 16 ms44 / 67 ms466 / 684 ms6.98 / 8.37 s
Date3,65410 / 13 ms19 / 24 ms90 / 106 ms684 / 901 ms7.39 / 8.76 s
Customer e-mailmax 100,00511 / 12 ms86 / 88 msrefusedrefusedrefused
Quantitymax 1,000,00510 / 10 ms81 / 86 msrefusedrefusedrefused

csvlite allows up to 100,000 distinct key combinations. In each of the final two rows, the operation and column stay the same as the file grows. The 1 MB and 10 MB tests succeed with 5,452 and 53,596 distinct values; the larger files cross the limit and are refused. The 10 GB tests below the limit finish in roughly six to nine seconds, including the time required to open the file.

Number of values counted

All of these tests group the rows into 56 keys. The only change is the number of distinct values that csvlite must retain for each group. Times are warm / cold medians.

Distinct count overValue space1 MB10 MB100 MB1 GB10 GB
Description227 / 8 ms14 / 20 ms57 / 79 ms579 / 745 ms7.59 / 8.88 s
Date3,6548 / 10 ms25 / 31 ms183 / 182 msrefusedrefused
Customer e-mailup to 100,0057 / 8 ms26 / 30 ms369 / 394 msrefusedrefused

The limit is 2,000,000 retained (group, value) pairs across all worker threads before their results are merged. That total reflects peak memory use. On this 16-thread machine, a result with 205,000 pairs can briefly occupy about 3.3 million pairs across the workers and exceed the limit. The same aggregation can complete with fewer worker threads, so this boundary depends on the number of cores available.

Method

  • The published matrix contains 1,800 runs: 18 operations, five file sizes, ten trials, and two cache states.
  • Each operation runs in a separate process and opens the file from scratch.
  • Sorts build the complete row order in memory. Filters continue until they have a final count of matching rows.
  • We checked result counts against an independent implementation before keeping the timings.
  • The runner explicitly preloads or evicts the source file before each trial.
  • The grouping tests deliberately cross csvlite’s limits. Of the 1,800 runs, 200 were refused and recorded as such.

Tests run 29 August 2026. These numbers measure csvlite only, using the 15-column files and machine described above.