breaks

Performance

A Million Rows a Side in Under 12 Seconds

Powered by Rust

Every figure below was measured on real hardware, from synthetic data with known answers.

  1. 10krows a side0.54 scash ledger0.54 sTPC-H orders
    Ran on
    1 thread · 256 MB limit
    Peak memory
    56 MB / 57 MB
  2. 100krows a side2.87 scash ledger3.37 sTPC-H orders
    Ran on
    1 thread · 256 MB limit
    Peak memory
    127 MB / 127 MB
  3. 1Mrows a side11.7 scash ledger15.0 sTPC-H orders
    Ran on
    8 threads · 512 MB limit
    Peak memory
    570 MB / 689 MB
  4. 10Mrows a side102 scash ledger129 sTPC-H orders
    Ran on
    12 threads · 4 GB limit
    Peak memory
    3.97 GB / 4.27 GB

Measured on an Apple silicon Mac, release build, from staged inputs, median of three runs. Each size uses the smallest thread count and memory limit within 10% of the fastest.

What was reconciled

Two Real-Shaped Reconciliations

Synthetic data with known answers: every break found matches the answer key. The same two reconciliations at every size.

Cash ledger vs statement

A cash ledger against its bank statement

  • 6columns a side
  • 1key
  • 1compared
  • 3carried

At a million rows a side: 1,000,000 ledger rows against 986,014 statement rows, and 280,719 breaks found.

TPC-H orders, two snapshots

TPC-H orders against the same table one snapshot later

  • 8columns a side
  • 1key
  • 4compared
  • 1carried

At a million rows a side: 1,001,880 orders on each side, and 50,600 breaks found.

Why it is fast

Vectorised, Not Row by Row

Every comparison takes a whole batch of values in one call, on every thread at once.

  • 2,048values per call
  • Every threadworks its own batches
  • Rustfor every comparison
Row by rowone value in each call
Thread 1
Thread 2
Thread 3
Thread 4

10 calls to compare 10 values

Vectorised, as breaks runs ita whole batch in each call
Thread 1
Thread 2
Thread 3
Thread 4

1 call compares up to 2,048 values

Measured on Apple silicon (ARM64, 128-bit NEON vector registers).

Scale

From Ten Thousand to Ten Million

A thousand times the rows, on the same machine. Ten million rows a side reconcile in under two minutes on the cash ledger.

Both axes on a log scale. Each size ran on its own setting: one thread up to a hundred thousand rows, eight at a million, twelve at ten million.

0.3131030100300 s10k100k1M10MRows a sideCash ledger, 10k rows a side: 0.54 sCash ledger, 100k rows a side: 2.87 sCash ledger, 1M rows a side: 11.7 sCash ledger, 10M rows a side: 102 sCashTPC-H orders, 10k rows a side: 0.54 sTPC-H orders, 100k rows a side: 3.37 sTPC-H orders, 1M rows a side: 15.0 sTPC-H orders, 10M rows a side: 129 sTPC-H

Where the time goes

The Comparison Is the Quick Part

Most of a run is preparing the two sides: reading types, normalising values and recording what was done. Matching is about a tenth of a million-row run.

Cash ledger vs statement

  1. 10k0.54 sPrepare 46%Other 28%
  2. 100k2.87 sPrepare 57%Match 17%
  3. 1M11.7 sPrepare 67%
  4. 10M102 sInputs 15%Prepare 71%

TPC-H orders, two snapshots

  1. 10k0.54 sPrepare 56%Other 17%
  2. 100k3.37 sPrepare 59%Match 20%
  3. 1M15.0 sPrepare 68%
  4. 10M129 sInputs 16%Prepare 72%

Each bar is one run, scaled to 100%. "Other" is starting the process and opening the workspace.

Runs on little

Fast on Little

More threads only help once there is enough work. Below a hundred thousand rows, one thread is as fast as twelve; at a million, threads help up to eight.

100k rows a side

01234 s124812Threads (4 GB limit)Cash ledger, 1 threads: 2.85 sCash ledger, 2 threads: 2.87 sCash ledger, 4 threads: 2.87 sCash ledger, 8 threads: 2.86 sCash ledger, 12 threads: 2.86 sCashTPC-H orders, 1 threads: 3.36 sTPC-H orders, 2 threads: 3.63 sTPC-H orders, 4 threads: 3.63 sTPC-H orders, 8 threads: 3.64 sTPC-H orders, 12 threads: 3.62 sTPC-H

1M rows a side

0102030 s1246812Threads (4 GB limit)Cash ledger, 1 threads: 25.3 sCash ledger, 2 threads: 17.6 sCash ledger, 4 threads: 13.2 sCash ledger, 6 threads: 12.9 sCash ledger, 8 threads: 11.2 sCash ledger, 12 threads: 11.4 sCashTPC-H orders, 1 threads: 31.2 sTPC-H orders, 2 threads: 21.8 sTPC-H orders, 4 threads: 16.5 sTPC-H orders, 6 threads: 16.3 sTPC-H orders, 8 threads: 14.2 sTPC-H orders, 12 threads: 14.2 sTPC-H

The memory limit barely changes the time

At a million rows a side on twelve threads, 512 MB is within about 6% of 4 GB. The time a run takes, not the memory it uses, is what this chart shows.

05101520 s256 MB512 MB1 GB2 GB4 GBMemory limit (12 threads, 1M rows a side)Cash ledger, 256 MB limit: 12.2 sCash ledger, 512 MB limit: 11.8 sCash ledger, 1 GB limit: 11.4 sCash ledger, 2 GB limit: 11.4 sCash ledger, 4 GB limit: 11.4 sCashTPC-H orders, 256 MB limit: 16.0 sTPC-H orders, 512 MB limit: 15.1 sTPC-H orders, 1 GB limit: 15.0 sTPC-H orders, 2 GB limit: 14.3 sTPC-H orders, 4 GB limit: 14.2 sTPC-H