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

Deltas between ticks

Toss-up

Requirement

From seven price ticks, print the six deltas: each tick next to its predecessor with the signed change to two decimal places (a flat tick prints +0.00). The data is in the code; both versions must print the lines shown under Expected output.

Expected output
101.20 -> 101.65  +0.45
101.65 -> 101.40  -0.25
101.40 -> 102.10  +0.70
102.10 -> 102.10  +0.00
102.10 -> 101.85  -0.25
101.85 -> 102.30  +0.45

Side by side

RxDart

FxDart

Why they differ

They don't, by design: pairwise is one of the operators FxDart ported from Rx, because "each value with the one before it" is just as natural whether values are pushed or pulled. Both sides keep one value of state, emit nothing for the first tick, and produce n − 1 pairs. The verdict is a tie and the interesting part is the small typing difference in what a "pair" is.

RxDart's pairwise emits a two-element List<double>p.first and p.last are honest but the length-2 invariant lives in documentation, not in the type. FxDart's emits a Dart record (double, double): p.$1 and p.$2 are the only fields there are, and the compiler knows it. That is a language-era artifact more than a model difference — records did not exist when RxDart's API froze — but it is representative of the pull library's habit of pushing invariants into types. On the model itself: nothing to choose between them here.

Benchmark

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

N = 100

Time Tie

RxDart 86 µs
FxDart 42 µs

Peak memory Tie

RxDart 16.6 MB
FxDart 16.5 MB

N = 1,000,000

Time FxDart wins

RxDart 762.6 ms
FxDart 439.3 ms

Peak memory Tie

RxDart 159.2 MB
FxDart 162.6 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.