First sensor reading over the limit
Requirement
A temperature sensor logs a reading every ten minutes. Find the first reading over the 75.0 C limit and print its time and value — or a fallback line if none crossed it. The data is in the code below; both versions must print the line shown under Expected output.
Expected output
First over 75.0 C: 09:40 at 76.3 C
Side by side
Native Dart
FxDart
Why they differ
They don't — and here plain Dart is the honest pick. Core
skipWhile plus firstOrNull (from
package:collection) is a clean, lazy one-liner that says
exactly what it means, with the same nullable result to handle. FxDart's
dropWhile → head is the same idea under FxTS names — worth
using if the rest of your file is already FxDart chains, but nobody
should add a library for this line. When native Dart wins, we say so.
Benchmark
N = 100
Time Tie
Peak memory Tie
N = 10,000
Time Tie
Peak memory Tie
N = 1,000,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.