Retry the flaky fetch
Requirement
The manifest endpoint resets the connection exactly twice before serving its payload. Retry until it succeeds, with a budget of three attempts in total, then print the payload and how many attempts it took. The failure injection is deterministic and in the code; both versions must print the lines shown under Expected output.
Expected output
manifest 2026-08 (12 entries) attempts: 3
Side by side
RxDart
FxDart
Why they differ
Scarcely at all — this is one call on each side, and that is the
point of the pair. The difference is what "try again" means
in each model. In RxDart a stream that has errored is dead, so
Rx.retry takes a factory and
re-subscribes it: retrying is re-listening, and the count argument is
the number of retries after the first attempt (here
2, for three attempts). In FxDart the flaky thing is a
Future-returning function, so
retry just calls it again — attempts is the
total budget (3), and the last error rethrows with its
original stack trace when the budget is spent.
A genuine tie. The shapes only diverge when the retried thing grows:
if it becomes a multi-value pipeline, RxDart keeps the same factory
idiom, while FxDart wraps the terminal
(retry(3, () => fxAsync(…).toList())) or moves to
per-element retries — a pair of its own, two examples ahead.
Benchmark
Async case: the headline scale is N = 10,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 FxDart wins
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.