Finale — DailyLedger monthly close
Requirement
Close the month for a personal ledger. Ten entries live in a store (fixed data in the code below); load each by id — at most three loads in flight, proven by the max-in-flight counter — then compute the July 2026 close: keep only July entries (one straggler is from June), split income from spending, total each side, and print the net plus the top three spending categories with entry counts.
The shapes here are lifted from a real app: the Entry
model, the income/spending split (filter →
partition → sumBy each half), and the
category breakdown (groupBy → per-group sumBy
→ sortBy descending → take(3)) mirror
DailyLedger's monthSummary and
categoryBreakdown pipelines, with the async load phase
(toAsync → map → concurrent(3))
in front.
Expected output
July 2026 close — 10 entries loaded, 3 at a time (max in flight: 3) income $3600.00 expense $1478.15 net $2121.85 top spending categories: housing: $1150.00 (1 entry) food: $206.35 (3 entries) utilities: $106.30 (2 entries)
Side by side
Native Dart
FxDart
Why they differ
Fifty examples in, this is the pattern they all add up to: plain Dart
needs three dialects for one feature — package:collection
helpers for grouping, fold with explicit seeds for the
totals, and a hand-rolled worker pool the moment the load phase needs a
concurrency bound. Each piece is fine; together they make the business
logic the hardest thing on the screen to find. The FxDart version is
the same vocabulary from the load phase to the report — and because
every stage is a pure pipeline, each one can be lifted out and unit
tested as entries in, view data out.
These pipelines are not a demo confection: they are how the DailyLedger demo app actually computes its dashboard — same model, same operators, running live in your browser. If the fifty comparisons showed you the words, DailyLedger is the sentence they were building toward.
Benchmark
Async case: the headline scale is N = 20,000, not 1,000,000. Every element costs an event-loop turn on both sides, so a million real awaits would measure Dart's event loop for minutes — not the pipeline. Delays are zero-length and the example's concurrency limit is kept; what the bars compare is the pipeline machinery.
N = 100
Time Tie
Peak memory Tie
N = 10,000
Time Tie
Peak memory Tie
N = 20,000
Time Tie
Peak memory Tie
Bars are medians of repeated timed iterations in fresh processes per side (small N is batched for timer resolution). Sides within 5% of each other — or within 0.6 ms, a difference no person can perceive — count as a tie; close relative races are re-measured up to 5 runs. In an app, anything under a few milliseconds is invisible to the user regardless of which bar is shorter. Memory is peak process RSS. The Dart VM and the dataset are identical on both sides, so the difference between the two bars is what the pipeline itself holds onto.