Skip to content

Conversation

@VAWVAW
Copy link
Contributor

@VAWVAW VAWVAW commented Jun 17, 2025

Profiling the startup of iamb in foot using flamegraph, I noticed that most of the cpu time was spent rendering image previews. This PR changes the rendering to be in the background (not blocking ui responsiveness) and lazily (on message rendering).

I had some bugs if the last message is an image:

  • Scrolling with ^E and ^Y doesn't work if the last message is focused
  • if only one image is loaded and the rest of the loaded events are reactions, older events don't load

Profiling data

before optimizations:
flamegraph-original
with lazily computed sixel preview:
flamegraph-lazy-sixel
and lazily decoded jpg:
flamegraph-lazy-jpg

@VAWVAW VAWVAW marked this pull request as ready for review August 19, 2025 22:10
@VAWVAW VAWVAW force-pushed the lazy-image-preview branch 2 times, most recently from 22fa520 to ab304a0 Compare September 20, 2025 11:38
@benjajaja
Copy link
Contributor

I had some bugs if the last message is an image:

* Scrolling with ^E and ^Y doesn't work if the last message is focused

* if only one image is loaded and the rest of the loaded events are reactions, older events don't load

@VAWVAW do you mean these were bugs that are fixed, or these are new issues in this PR?

@VAWVAW
Copy link
Contributor Author

VAWVAW commented Oct 14, 2025

I just did some more testing and it looks like both are bugs that are in the main branch and were neither introduced nor fixed by this PR.

Copy link
Contributor

@benjajaja benjajaja left a comment

Choose a reason for hiding this comment

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

Thank you!

Just tested it, works smooth as butter.

Image

@VAWVAW VAWVAW force-pushed the lazy-image-preview branch from ab304a0 to 3a921ce Compare October 26, 2025 12:19
@VAWVAW VAWVAW force-pushed the lazy-image-preview branch from 3a921ce to d713278 Compare October 26, 2025 15:09
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