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

First sensor reading over the limit

Native is fine

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

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

N = 100

Time Tie

Native Dart 1.1 µs
FxDart 969 ns

Peak memory Tie

Native Dart 16.4 MB
FxDart 16.5 MB

N = 10,000

Time Tie

Native Dart 54 µs
FxDart 55 µs

Peak memory Tie

Native Dart 15.3 MB
FxDart 15.4 MB

N = 1,000,000

Time Tie

Native Dart 4.95 ms
FxDart 5.22 ms

Peak memory Tie

Native Dart 117.9 MB
FxDart 117.2 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.