Skip to content

Optimize display list walk to one pass - #21

Merged
bettio merged 1 commit into
atomvm:mainfrom
TomHoenderdos:one-pass-walk
Oct 1, 2026
Merged

bettio merged 1 commit into
atomvm:mainfrom
TomHoenderdos:one-pass-walk

Conversation

@TomHoenderdos

Copy link
Copy Markdown
Contributor

Split out of #18.

To find how far an item may draw from a pixel, every renderer called *_find_max_line_len(), which scanned all the items above the drawn one again. Each draw call walked the item list twice, so a long display list cost time proportional to the square of its length on every run of pixels.

The item loop in the DCS LCD, mono, e-paper and SDL renderers now keeps that limit as a running minimum while it walks the items once. It considers the same items as before (those above the drawn one that start further right on the row), so the output is unchanged. The *_find_max_line_len() functions are removed.

The scaled_cropped_image renderers also stop reducing the item width to the remaining source image, since the parser does that since #19.

Testing:

  • tests/items (ASan + UBSan, against AtomVM release-0.7): all 396 checks pass, including the pixel checks of images under occluding rects.
  • ESP32 build against AtomVM release-0.7 with IDF 5.4.3 and 5.5.2.

🤖 Generated with Claude Code

To find how far an item may draw from a pixel, every renderer called
*_find_max_line_len(), which scanned all the items above the drawn
one again. Each draw call walked the item list twice, and a long
display list cost time proportional to the square of its length on
every run of pixels.

The item loop in the DCS LCD, mono, e-paper and SDL renderers now
keeps that limit as a running minimum while it walks the items once:
an item above that starts further right on the row shortens the run,
as before. The output is unchanged. The *_find_max_line_len()
functions are removed.

The scaled_cropped_image renderers also stop reducing the item width
to the remaining source image, since the parser already does so.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Tom Hoenderdos <tomhoenderdos@gmail.com>
@bettio
bettio merged commit afc83ef into atomvm:main Oct 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants