Эта страница ещё не переведена, поэтому показана на английском. Помогите с переводом

Refunds vs charges, both formatted

FxDart wins

Requirement

A ledger mixes charges and refunds (negative amounts). Split it into the two groups, format every transaction as merchant $amount, and print one line per group — refunds first. The data is in the code below; both versions must print the lines shown under Expected output.

Expected output
refunds: Web Store $89.99, Airline $120.00, Book Nook $27.99
charges: Cafe Aroma $12.50, Web Store $89.99, Noodle Bar $18.90, Airline $240.00, Green Grocer $43.20

Side by side

Native Dart

FxDart

Why they differ

Dart has no partition — when you need both halves, where only gives you one, so the native version filters twice: once with the predicate, once with its negation, written out by hand (< 0 and >= 0). That is two passes over the data and two predicates to keep in sync — if the refund rule ever changes, nothing forces the second line to follow. FxDart's partition makes the split one declaration: a single predicate, a single pass, and a record destructure that names both halves. The map + join formatting afterwards is the same in both.

Benchmark

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

N = 100

Time Tie

Native Dart 28 µs
FxDart 21 µs

Peak memory Tie

Native Dart 16.5 MB
FxDart 16.5 MB

N = 10,000

Time Tie

Native Dart 2.20 ms
FxDart 1.93 ms

Peak memory Tie

Native Dart 23.4 MB
FxDart 22.9 MB

N = 1,000,000

Time FxDart wins

Native Dart 253.3 ms
FxDart 235.9 ms

Peak memory Tie

Native Dart 176.1 MB
FxDart 178.8 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.