No description
  • HTML 91.5%
  • Shell 6.3%
  • OCaml 2%
  • Makefile 0.2%
Find a file
David Sancho Moreno cb3e703cfd Tweak learnings
2026-03-15 19:31:30 +00:00
.tools Initial oxcaml + dune pkg 2026-03-14 15:51:14 +00:00
docs Tweak learnings 2026-03-15 19:31:30 +00:00
dune.lock Initial oxcaml + dune pkg 2026-03-14 15:51:14 +00:00
results Push results 2026-03-15 18:12:19 +00:00
scripts Push results 2026-03-15 18:12:19 +00:00
skills/oxcaml Add README 2026-03-15 19:10:31 +00:00
.gitignore Initial oxcaml + dune pkg 2026-03-14 15:51:14 +00:00
dune Initial oxcaml + dune pkg 2026-03-14 15:51:14 +00:00
dune-project Initial oxcaml + dune pkg 2026-03-14 15:51:14 +00:00
dune-workspace Initial oxcaml + dune pkg 2026-03-14 15:51:14 +00:00
generate.ml Initial oxcaml + dune pkg 2026-03-14 15:51:14 +00:00
main.ml Push results 2026-03-15 18:12:19 +00:00
Makefile Fix Makefile commands 2026-03-15 19:21:32 +00:00
README.md Fix Makefile commands 2026-03-15 19:21:32 +00:00

Parsing 1B rows in Ocaml

Inspired by the 1 Billion Row Challenge in Java and 1brc by taekim in Bun/TypeScript, I wanted to implement it in OCaml (and try some of the OxCaml features).

Current best run (results/2026-03-14_20-23-25_136617877.txt):

  • Total rows processed: 1,000,000,000
  • Total time (wall clock): 3.49s
  • Internal timer (Processed in): 0.87s
  • Average throughput (wall clock): 286,532,951 rows/second

System specs

  • OS: Linux 6.12.22+bpo-amd64 (x86_64)
  • CPU: 2x AMD EPYC 9755 128-Core Processor (256 cores / 512 threads)
  • Memory: 2.2TiB RAM
  • OCaml: 5.2.0+ox
  • Dune: 3.21.1

Instructions

Step 0: Use dune pkg manager

Install dune 3.21.1

Step 1: Create the file with 1 billion rows

Install dependencies, this project is configured to work with OxCaml (OCaml 5.2.0+ox).

make install

Generate the measurements file:

make generate

NOTE: file is about 13.8GB (data/measurements.txt), make sure you have enough space.

Step 2: Run the parser

Build the project:

make build

Run it on a test file first:

dune exec ./main.exe -- data/small.txt

Run it on measurements.txt (the 13.8GB file):

/usr/bin/time -v dune exec ./main.exe -- data/measurements.txt