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

CSS backdrop-filter affects photo gallery scrolling animations FPS (+ other places) #212

Closed
Alex0007 opened this issue Aug 14, 2023 · 5 comments
Labels
bug Something isn't working performance

Comments

@Alex0007
Copy link

Alex0007 commented Aug 14, 2023

Describe the bug
A clear and concise description of what the bug is.

Swiping photos is unpleasant experience due to FPS drops

  • Which site: dev.phanpy.social

To Reproduce
Steps to reproduce the behavior:

  1. Go to post with multiple photos, e.g https://dev.phanpy.social/#/mstdn.social/s/110885138853427849
  2. Preview first photo
  3. Swipe to next photo
  4. Observe FPS drops during this action

P.S. you can hide control elements, by tapping photo. After hiding – FPS is no longer dropping (because .plain2, plain3 class elements are hidden)


Comment out these two styles and gallery animation framerate will dramatically increase.

I guess this happens because of transparent + blur() on moving photos, which consumes a lot of CPU on each frame

Ref: https://github.com/cheeaun/phanpy/blob/main/src/index.css#L199

:is(button, .button).plain2 {
  background-color: transparent;
  color: var(--link-color);
  /* backdrop-filter: blur(12px) invert(0.1); */
}
:is(button, .button).plain3 {
  background-color: transparent;
  color: var(--button-text-color);
  /* backdrop-filter: blur(12px) invert(0.25); */
}

Smartphone (please complete the following information):

  • Device: Google Pixel 6
  • OS: Android 14
  • Browser Google Chrome 115

Additional context
I have checked locally, that removing those backdrop-filter solves problem, but i'm not a frontend guy, so i don't know how to correctly replace them with somewhat similar

@Alex0007 Alex0007 changed the title CSS backdrop-filter affects animations FPS CSS backdrop-filter affects photo gallery scrolling animations FPS Aug 14, 2023
@cheeaun cheeaun added bug Something isn't working performance labels Aug 14, 2023
@Alex0007 Alex0007 reopened this Aug 16, 2023
@Alex0007
Copy link
Author

Alex0007 commented Aug 16, 2023

Gallery fix worked 👍


Screenshot 2023-08-17 at 03 44 07

div.media-play also hits performance 🥲

Might be a good idea to double-check every place with this filter
backdrop-filter:.*blur\( (21 results in 9 files)

It will really improve users experience. Now it is lagging even on my Macbook M1 Air (not everyone can notice that, but still)

@cheeaun if you don't have time to fix this, just let me know what is resolution strategy for those cases, and i will try to make PR

@cheeaun
Copy link
Owner

cheeaun commented Aug 17, 2023

@Alex0007 is this a different bug? I can understand if this lags on a phone but it seems weird that it's lagging on a desktop (especially on M1 😲). Is it possible if you can check/pinpoint if the blur is the main cause for this case, maybe have a user-style to disable all backdrop-filter styles 🙏

@Alex0007
Copy link
Author

Alex0007 commented Aug 17, 2023

It is same kind of bug, but in different place (now in "play" overlay above videos, which also has that blur style)

especially on M1 😲

It's not that noticeable on notebook. On the phone you can see micro freezes when blurred element appear on the screen. While on notebook smooth scrolling stops being smooth.

You might think I'm crazy, but this performance problems are really blocking me from using Phanpy on the phone.

Most annoying bug was gallery one and now it's fixed, but maybe it's worth to fix remaining places to get ideal performance

Is it possible if you can check/pinpoint if the blur is the main cause for this case

Now gallery swipes perform great, and I have noticed that before looking into commits history. So yes, it is the case.

Not sure every blur in codebase dips performance. For example header blur is fine, as well as text blur in spoilers (but spoiler with additional elements, like pictures or polls is lagging too)

@Alex0007 Alex0007 changed the title CSS backdrop-filter affects photo gallery scrolling animations FPS CSS backdrop-filter affects photo gallery scrolling animations FPS (+ other places) Aug 17, 2023
@Alex0007
Copy link
Author

Closing for now until i get more evidence of drops

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working performance
Projects
None yet
Development

No branches or pull requests

2 participants