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

Rank labels for a leaderboard

Toss-up

Requirement

A leaderboard is already sorted by score, highest first. Print one rank label per player — 1-based position, name, score. The data is in the code below; both versions must print the lines shown under Expected output.

Expected output
1. Hana (982 pts)
2. Dan (951 pts)
3. Ava (917 pts)
4. Finn (862 pts)
5. Cara (840 pts)
6. Ben (799 pts)

Side by side

Native Dart

FxDart

Why they differ

Only in name. Dart 3's indexed yields exactly the (index, element) records that FxDart's zipWithIndex does, so the two map callbacks are character-for-character identical — a clean tie, and a good example of Dart's core library catching up (before records and indexed, the native side was a manual counter). Use zipWithIndex when you're already inside an fx chain — it also exists on async chains — and indexed everywhere else.

Benchmark

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

N = 100

Time Tie

Native Dart 15 µs
FxDart 15 µs

Peak memory Tie

Native Dart 16.4 MB
FxDart 16.5 MB

N = 10,000

Time Tie

Native Dart 1.69 ms
FxDart 1.72 ms

Peak memory Native wins

Native Dart 34.8 MB
FxDart 37.8 MB

N = 1,000,000

Time Tie

Native Dart 226.0 ms
FxDart 232.7 ms

Peak memory FxDart wins

Native Dart 239.5 MB
FxDart 223.1 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.