emilk / emilk/egui

ScrollArea::show_rows() scrolling jitters with very large total_rows

Open
#1,391 1 comment 2 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

**Describe the bug**

I have a UI with about 16 million rows (but this is on the low end of what I want to support). I'm using `ScrollArea::show_rows()` to keep a sane viewport size.

Up to about 2 million rows, scrolling with the trackpad or by dragging the background with a mouse is relatively smooth. Above 2 million total rows, scrolling has some obvious jitter. Above 100 million total rows, the scrolling gets very broken.

It looks like an issue with `f32` precision, but I haven't been able to track it down yet.

**To Reproduce**
Steps to reproduce the behavior:
1. Patch the demo lib to increase the `num_rows` to `16_000_000`: https://github.com/emilk/egui/blob/ccbddcfe951e01c55efd0ed19f2f2ab5edfad5d9/egui_demo_lib/src/apps/demo/scrolling.rs#L85
2. Run the demo and go to the "Scolling" demo and then the "Scroll a lot of lines" tab.
3. Scroll with the trackpad or by dragging the background with the mouse.
4. You'll see it does not scroll smoothly.
5. Increase `num_rows` to `160_000_000` and try the same test.
6. Scrolling is almost completely unusable with this many rows.

**Expected behavior**

Always scroll smoothly regardless of the total number of rows.

**Desktop (please complete the following information):**
- OS: Windows 11, macOS 12.2.1

Contributor guide

Open the contributing guide

Research direction

Start with egui_demo_lib/src/apps/demo/scrolling.rs at the num_rows setting and run the “Scroll a lot of lines” demo with 16,000,000 and 160,000,000 rows. Trace how ScrollArea::show_rows handles scrolling and large coordinates, then verify that trackpad scrolling and mouse dragging remain smooth at those sizes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.