このページはまだ翻訳されていないため、英語で表示されます。 翻訳に参加する

Detect duplicated transactions

FxDart wins

Requirement

A charge that appears twice with the same merchant, amount, and day is probably a double-swipe. Find every such group in July's transactions and list each transaction involved so the user can review them — but do not flag the same merchant and amount on different days (a repeat coffee is not a duplicate). The data is in the code below; both versions must print the lines shown under Expected output.

Expected output
Possible duplicate charges:
2026-07-08  Noodle Bar  $18.90
2026-07-08  Noodle Bar  $18.90
2026-07-21  StreamFlix  $9.99
2026-07-21  StreamFlix  $9.99

Side by side

Native Dart

FxDart

Why they differ

The algorithm is group–keep–flatten, and FxDart writes it as exactly those three words: groupBy the merchant|amount|day key, filter the groups with more than one member, flatMap the survivors back into individual transactions (map + join format them). Native Dart has none of the three as vocabulary: grouping becomes a putIfAbsent loop, keeping-and-flattening becomes nested for loops with an if between them. Both are correct; only one still looks like the sentence that specified it.

Benchmark

Apple M1 Max, 32 GB RAM · Dart 3.12.2 (AOT-compiled) · 2026-08-24

N = 100

Time Tie

Native Dart 50 µs
FxDart 42 µs

Peak memory Tie

Native Dart 16.5 MB
FxDart 16.5 MB

N = 10,000

Time Tie

Native Dart 4.17 ms
FxDart 3.86 ms

Peak memory FxDart wins

Native Dart 40.2 MB
FxDart 36.0 MB

N = 1,000,000

Time Tie

Native Dart 977.4 ms
FxDart 966.1 ms

Peak memory Tie

Native Dart 324.6 MB
FxDart 332.5 MB

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.