Bound block bookkeeping with compact intervals
perfloop/zed · INEFFICIENT ALGORITHM
https://perfloop.ai/t/oss/case_rhbfgnv4pj
Verdict
VERIFIED · settled 2026-08-12
What happened: The paired measurements met the required improvement.
Hypothesis
The directed locality resolves to EditorElement::render_block in crates/editor/src/element.rs at lines 3164–3433, and it is the destination of the accepted per-frame Frame rendering path hop from crates/editor/src.impl.render_blocks. The submitter reports that this function inserts row_block_types once across 0..element_height_in_lines and cites an external issue/profile attributing UI-thread samples to HashMap<DisplayRow, bool>::insert; that attribution is not independently measured in this model-build run. Structurally, the bookkeeping growth is with wrapped display-row height rather than block count, so a block with extremely many wrapped rows can make this body perform one map insertion per row. The proof target is a reproducible frame/render benchmark sweeping wrapped display-row count on both sides of any interval-lookup crossover while holding block count and visible rows constant, collecting frame latency, render_block CPU/insertion counts, and a correctness differential that verifies identical row-to-block lookup results.
Change to test: Replace row_block_types per-display-row HashMap entries with ordered block intervals. Resolve a row's block type from the containing interval, preserving the current lookup result without expanding one entry per wrapped row.
Where it lives
perfloop/zed · crates/gpui/src/window.rs
Evidence
steady-state editor frame with one 1-row Flex block in an 800x600 viewport · 10 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
editor_render_tall_block_1_frame_ns |
318884 |
318826 |
−0.1% (−265.7) |
−1120 to +968.5 |
≤ 100000 |
PASSED |
steady-state editor frame with one 128-row Flex block in an 800x600 viewport · 10 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
editor_render_tall_block_128_frame_ns |
164049 |
161460 |
−1.5% (−2459) |
−3514 to −1658 |
≤ 100000 |
PASSED |
steady-state editor frame with one 32768-row Flex block in an 800x600 viewport · 10 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
editor_render_tall_block_32768_frame_ns |
717441 |
161803 |
−77.5% (−555833) |
−558403 to −553053 |
< 0 |
PASSED |
steady-state editor frame with 256 disjoint two-row Flex blocks · 10 sample pairs
| metric | baseline | candidate | paired median change | confidence range | required | result |
|---|---|---|---|---|---|---|
editor_render_disjoint_two_row_blocks_frame_ns |
8221580 |
8218082 |
−0.7% (−53948) |
−1720923 to +45842 |
≤ 1000000 |
PASSED |
Checks: 5 of 5 passed. Verification: no defect found.
Timeline
2026-08-10· Case opened