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

App is low on fps on new upgrade to android 11 #5046

Closed
Barlerer opened this issue Dec 18, 2020 · 88 comments · Fixed by #5199 or #5409
Closed

App is low on fps on new upgrade to android 11 #5046

Barlerer opened this issue Dec 18, 2020 · 88 comments · Fixed by #5199 or #5409

Comments

@Barlerer
Copy link

Barlerer commented Dec 18, 2020

Summary

Since upgrading my S20 plus to the new android 11 update, the app appears to perform super slow. I have also attached a view, and the low fps you will see is not from the recording, but from only the mattermost app.

Environment Information

  • Device Name: Samsung Galaxy S20 Plus
  • OS Version: Android 11
  • Mattermost App Version: 1.38.0
  • Mattermost Server Version: 5.26.0

Steps to reproduce

Have an S20 with the latest update, install mattermost app and try to use anything, you will notice the sluggish behaviour

Expected behavior

Before the upgrade, the app used to work very fast and was performing well.

Observed behavior

Doesn't matter which channel or team, once I open the app every thing is very low performance
Video the online preview makes it a bit hard to see the difference, try to download the file to best see the issue

Possible fixes

If you can, link to the line of code that might be responsible for the problem.

@amyblais
Copy link
Member

Does this happen after re-installing the app? We suspect this may be device-specific.

@Barlerer
Copy link
Author

Barlerer commented Dec 18, 2020 via email

@koenrot
Copy link

koenrot commented Dec 21, 2020

Just here to let you know I have the exact same issue on a similar phone.

There is no difference in having the phone run on 120fps or 60 fps. The app appears to be running on a much lower framerate. Can't really say how much fps exactly, but if I have to guess it would be lower than 25fps.

Environment Information

  • Device Name: Samsung Galaxy S20
  • OS Version: Android 11
  • Mattermost App Version: 1.38.1
  • Mattermost Server Version: 5.26.0

@SteveJos
Copy link

SteveJos commented Jan 6, 2021

I can confirm this issue since the upgrade to Android 11 on my Samsung Galaxy S20+
The navigation in the app is sluggish and slow.
The developer overlay shows a maximum of 30fps in the app. All other apps works as usual.
Screenshot_20210106-110146_Mattermost

@panther7
Copy link

panther7 commented Jan 9, 2021

Same problem, Samsung S10e, Android 11... Maybe bug is in OneUI 3.0 by Samsung.

@dmitriy-boev
Copy link

Same thing on s10, android 11.

@kirkbowe
Copy link

Same low frame rate issue on Samsung Note 20 Ultra. Latest Android 11 and One UI 3. Mattermost client 1.39.0 (build 3000341). Have not noticed any other apps exhibiting the same issue. No difference whether device is set to fixed 60 Hz or adaptive 120 Hz. Had a quick look at a few other React Native apps but didn't notice the same issue.

@rajpootathar
Copy link

same issue on my galaxy note 10 + , android 11 and one UI 3 update.

@loicsapone
Copy link

Same problem on my Samsung since the upgrade from Android 10 to 11 (OneUI 2 to 3)

Environment Information

Device Name: Samsung Galaxy S10
OS Version: Android 11, OneUI 3.0
Mattermost App Version: 1.39.0
Mattermost Server Version: 5.30.0

@jfolz
Copy link

jfolz commented Jan 30, 2021

Also here, S10e after update to Android 11 / OneUI 3.0. The actual chat portion of the app is barely usable. Settings and such are unaffected.

@ahmednabil950
Copy link

I am using s20 plus and i can tell this is a confirmation that the app on latest upgrade is really super slow in navigation and any animation effect is slow (very obvious in side menu)

@dmitriy-boev
Copy link

Seems resolved after latest web view update.

@amyblais
Copy link
Member

amyblais commented Feb 2, 2021

Would you have more details on what update fixed the issue?

@rezun
Copy link

rezun commented Feb 2, 2021

Seems resolved after latest web view update.

I just installed the most recent version 88.0.4324.141 (released today) but it didn't change anything. The problem still persists.

@jfolz
Copy link

jfolz commented Feb 3, 2021

Update didn't make any difference for me either. Same for the beta, dev, and canary WebView apps. There is no appreciable difference between any of these.

@Barlerer
Copy link
Author

Barlerer commented Feb 3, 2021

Same for me, updated web views and not change

@stuartm
Copy link

stuartm commented Feb 10, 2021

Same issue with S10 updated to Android 11, it's unusable. Conversely mattermost in the browser on the same device is lightning fast. This is the only app with the issue so far in my testing, that includes other html based apps using webview.

@AIRpwnz
Copy link

AIRpwnz commented Feb 11, 2021

Same for me, samsung s10e
Very low fps in the app

@vbrz
Copy link

vbrz commented Feb 12, 2021

I also have this issue (Galaxy S20 Ultra)

@panther7
Copy link

panther7 commented Feb 12, 2021

We know, we know, problem is Samsung/OneUI 3.0/Android 11.

Question is, whether will be Mattermost app fixed?

@enahum
Copy link
Contributor

enahum commented Feb 17, 2021

Hi all, I've attempted something to try and see if it helps, I was unable to really test it as the app worked without issues on my Pixel 4.

Would you please try running this version https://pr-builds.mattermost.com/mattermost-mobile/android-pr-fps/Mattermost_Beta.apk and report back?

Thanks in advance

@rajpootathar
Copy link

Hi all, I've attempted something to try and see if it helps, I was unable to really test it as the app worked without issues on my Pixel 4.

Would you please try running this version https://pr-builds.mattermost.com/mattermost-mobile/android-pr-fps/Mattermost_Beta.apk and report back?

Thanks in advance

Hi @enahum , I tried the build you mentioned.. it is still clunky and fps are really bad for me

device : Note 10 + (One Ui 3+)
Android Version : 11

@enahum
Copy link
Contributor

enahum commented Feb 17, 2021

@rajpootathar interesting as I'm setting the app to use the max amount of fps available on the device

 protected void setFrameRate() {
        ArrayList<HashMap<String, Object>> supported = getSupportedModes();
        boolean seen = false;
        HashMap<String, Object> best = null;
        for (HashMap<String, Object> stringObjectHashMap : supported) {
            if (!seen || (Float)stringObjectHashMap.getOrDefault("refreshRate", 0f) > (Float)best.getOrDefault("refreshRate", 0f)) {
                seen = true;
                best = stringObjectHashMap;
            }
        }

        if (best != null && best.get("id") != null) {
            final Window window = this.getWindow();
            final WindowManager.LayoutParams params = window.getAttributes();
            params.preferredDisplayModeId =(int)best.get("id");
            window.setAttributes(params);
        }
    }

wondering what else could cause this and also why it only seems to be affecting Samsung with One UI 3+

@Barlerer
Copy link
Author

Hi all, I've attempted something to try and see if it helps, I was unable to really test it as the app worked without issues on my Pixel 4.

Would you please try running this version https://pr-builds.mattermost.com/mattermost-mobile/android-pr-fps/Mattermost_Beta.apk and report back?

Thanks in advance

Also doesn't work for me

@enahum
Copy link
Contributor

enahum commented Feb 17, 2021

One long shot, what happens if you enable Developer options in your phone and change the settings for:

  • Window animation scale
  • Transition animation scale
  • Animator duration scale

and set them all to .5x

@Barlerer
Copy link
Author

One long shot, what happens if you enable Developer options in your phone and change the settings for:

  • Window animation scale
  • Transition animation scale
  • Animator duration scale

and set them all to .5x

Also doesn't work.

@svelle
Copy link
Member

svelle commented Feb 18, 2021

Hey @SteveJos could you give me some more info on what kind of tool you used to get these detailed metrics from your screenshot. I'm seeing similar behavior on my Pixel 5 and would like to further investigate.

@VincentSC
Copy link

@VincentSC
Copy link

For measuring performance see https://developer.android.com/training/testing/performance
I'm happy to run a test, but have no time to define it.

@chicout
Copy link

chicout commented Apr 15, 2021

I have the same issue with my new Samsung S21 Ultra

@Barlerer
Copy link
Author

Barlerer commented May 7, 2021

Just to reiterate, the issue does get worse the more text is on screen. If it is files\images it works well.

@mech01nc01
Copy link

mech01nc01 commented May 16, 2021

hello,

we have the same issue, especially when lots of text is visible, extremely if someone quotes lots of text

2xS20+, more than 20 Motorola G30 (all Android 11)
Version 5.34.2
App-Version 1.43.0

we could send you a test-device if it would help

@enahum
Copy link
Contributor

enahum commented May 17, 2021

Hey guys, made a minor tweak to the app and want to validate if that makes a difference for you.

Here is an apk to test it out.

@Barlerer
Copy link
Author

It is the same for me 😢

@enahum
Copy link
Contributor

enahum commented May 17, 2021

@Barlerer when you say the same, you mean channel with lots of text do look janky when scrolling up/down ? or blank spaces?

would you mind sharing a video?

@Barlerer
Copy link
Author

video_2021-05-17_18-51-36.mp4

@rezun
Copy link

rezun commented May 17, 2021

Also tested that apk version and it didn't make a difference for me (on S20).
Stuttering is happening when text is seen. If it's mostly images, it's smooth.
It's the same with the channel list btw. Since that is text only, it also stutters when scrolling there.

@larsellingsen
Copy link

I have an interresting observation on this issue: When I scroll in a search result page, the scrolling i perfectly smooth. So when i scroll in a normal channel, the scrolling stutters. But when i search for the same channel with "in:channelname", the resulting page has normal smooth scrolling.

(S10 Plus, Android 11, One UI 3.1, app version 1.43.0 build 3000356)

@Barlerer
Copy link
Author

@larsellingsen That's a good one. Also for me, the scrolling works like wonder when viewed from the search.

@enahum
Copy link
Contributor

enahum commented May 18, 2021

@larsellingsen thanks for the observation, that is really helpful.

I started digging into this and other related matters and I'm looking to do the following to help with performance:

  • try and measure the height of each post before it gets saved to the data store, that way the list won't need to perform calculations while the messages are being rendered on screen. (At least make the best to estimate it as accurate as possible but there are too many variants and only one thread)
  • refactor the post list and post components to make them lightweight

The above is going to take some time, but with the hope that it helps.

The one thing that I'm banging my head with, is the fact that it appears to studder only when text or large amout of text is displayed, I know recently someone found that the Text component for RN is not performing great but not sure why is causing this on the main post list but not anywhere else (ie: search) could it be the amount of posts? 🤔

Anyway, I'll be quiet for a while and try and nail this thing down, if you can think of ways to fix this, please reach out to me in the community server.

@jfolz
Copy link

jfolz commented May 18, 2021

The one thing that I'm banging my head with, is the fact that it appears to studder only when text or large amout of text is displayed, I know recently someone found that the Text component for RN is not performing great but not sure why is causing this on the main post list but not anywhere else (ie: search) could it be the amount of posts? 🤔

Number of posts/results doesn't seem to matter. Even searches with a lot of results (hundreds) are fast and I made a channel with a ton of (nonsense) posts that renders fast. The trick is that there can only be one word per line with explicit line breaks. I also tried three words per line and noticed this is slightly slower than it should be, but nowhere near as bad as "normal" messages. Maybe something in channels is forcing soft line wrap to be calculated over and over?

@enahum
Copy link
Contributor

enahum commented May 18, 2021

So I found out that the channel post list is inverted and that is causing the thing to lag.. after changing the list to not to be inverted (same as search) then it feels super smooth (like search).

I need to dig into the react-native code and see if I'm able to spot the reason why this happens.

@enahum
Copy link
Contributor

enahum commented May 18, 2021

Also found this.. facebook/react-native#30034 they mention that scrolling with the keyboard opened does not seem to lag (which is true for me).

Perhaps we should try and add our findings in that github issue..

@enahum
Copy link
Contributor

enahum commented May 18, 2021

Ok after playing with this for a while and while there is still work to be done, can you please try with this build and see if this one resolves the lag on scroll?

Thanks.

@VincentSC
Copy link

So. Much. Better! Thanks!
(Samsung Note10+)

@rezun
Copy link

rezun commented May 18, 2021

@enahum
Indeed, that build is smooth as butter on my S20

@enahum
Copy link
Contributor

enahum commented May 18, 2021

Let's wait on the others to report back as I want to get as much eyes as possible before I continue moving forward with the rest of the work needed.

Thanks for your patience and guidance to try and figure out what in the hell was wrong here.

@TwizzyDizzy
Copy link

TwizzyDizzy commented May 18, 2021

@enahum

can you please try with this build and see if this one resolves the lag on scroll?

With this beta build I can confirm the absence of any and all perceived lags. As smooth as freshly shaved. Thanks for your efforts!

Device: Pixel 2 XL (taimen) on LineageOS 18.1 (Android 11).

Cheers & Thanks
Thomas

@larsellingsen
Copy link

The beta is smooth as silk on my S10+! Thank you @enahum! 😃👏🏻👏🏻

@Barlerer
Copy link
Author

Words cannot describe how happy I am that Mattermost is finally usable again on my phone!
Works perfectly!

@mech01nc01
Copy link

also tested on S20+, works like charm ;)

@VincentSC
Copy link

I'm now really curious why it was initially only not working on specific phones, which were all fast. Reproduction was the main problem, so I did not expect something non-UI. Can anybody explain?

@enahum
Copy link
Contributor

enahum commented May 19, 2021

@VincentSC on Android 11 the FlatList component transformation had a performance degradation when using transform:[{scaleY: -1}] which is what React Native ships as default for vertically inverted lists, this degradation is not seen when applying the "deprecated" scaleY: -1 property without transformation, the reality is that this was a lucky strike by someone who was facing the same problem as you can read here facebook/react-native#30034

@Ch1llb0
Copy link

Ch1llb0 commented May 20, 2021

It's smooth and perfect here as well. Please get this out as a regular update to users as fast as possible 👍🏻 Great work, thank you!

@enahum
Copy link
Contributor

enahum commented May 20, 2021

It's smooth and perfect here as well. Please get this out as a regular update to users as fast as possible 👍🏻 Great work, thank you!

Thanks @Ch1llb0 will try but I'm still working on some other needed improvements that require a bit of time before we can ship the "fix", my rough estimate to submit the PR is about a week or so, just wanted to confirm this build caused the desired effect. Sorry about the inconvenience.

@enahum
Copy link
Contributor

enahum commented Jun 3, 2021

Next release does have this fix and other perf improvements ;)

Thanks guys for your patience and help ❤️

@panther7
Copy link

panther7 commented Jun 3, 2021

Finally, thanks...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet