Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't fill out of viewport text #2611

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

tarkah
Copy link
Member

@tarkah tarkah commented Sep 27, 2024

Super smol optimization. There's no need to submit this rendering operation when text is out of viewport. In halloy we leverage this optimization and it has a huge impact on primitive generation timings when dealing w/ lots of text in a scrollable.

@tsuza
Copy link

tsuza commented Sep 28, 2024

I've tested it with ~10k text widgets, containing Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua in one of my projects.
Scrolling with upstream iced is much, much, laggier. This PR makes it buttery smooth.

I've attached some screenshots of the debug info, before ( 0.13.1 stable branch ) & after ( this PR's branch ), while scrolling or idling.

There shouldn't have been too many changes in the dev branch ( 0.14.0 ) in comparison to the stable branch ( 0.13.1 ), so it shouldn't impact the fps too much. Though if it's the case, I can re-do the tests.

2024-09-27_18-25
2024-09-27_18-25_1
2024-09-28_02-55
2024-09-28_02-55_1

@tarkah
Copy link
Member Author

tarkah commented Sep 28, 2024

Thanks for the detailed comparison. Render times are way down!

@tamewild
Copy link

tamewild commented Sep 28, 2024

IIRC, this might be fixed when Iced's glyphon has this: grovesNL/glyphon#108

Edit: This PR will still help though with primitive generation (particularly for a huge amount of small text widgets) I believe. The glyphon thing is more relevant for the editor and a single text widget with a huge amount of text

Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to cull primitives in column and row instead of text. This way, we cull any primitive and all widgets benefit.

Let me know if that works.

@hecrj hecrj added this to the 0.14 milestone Oct 2, 2024
@hecrj hecrj added improvement An internal improvement performance widget labels Oct 2, 2024
Copy link
Member Author

@tarkah tarkah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@hecrj hecrj merged commit d5f278b into iced-rs:master Oct 2, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants