Skip to content

[Android][MAUI-8.0.7] CPU usage consistently remains above 10%, even without any operation #20684

Closed

Description

@BaY1251

Description

When there is a 'CollectionView' with property set to ItemsLayout="HorizontalList", the interface responds very slowly.CPU is always occupied, maintaining around 20%

Steps to Reproduce

Download https://github.com/BaY1251/MauiDebug.git

  1. Open /HorizontalList/HorizontalList.sln
  2. Change configuration to 'Release', and deployment the project
  3. Wait for 5 minutes, do not take any action during this period
  4. Command line input adb shell top -n 1 | findstr "\<com.companyname.horizontallist\> \<PID\>"' to view CPU usage.
  5. Waiting for what you think is a long enough time
  6. Command line input adb shell top -n 1 | findstr "\<com.companyname.horizontallist\> \<PID\>"' to view CPU usage.

Link to public reproduction project repository

https://github.com/BaY1251/MauiDebug.git

Version with bug

8.0.7 SR2

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.6 SR1

Affected platforms

Android

Affected platform versions

Android7.1

Did you find any workaround?

No response

Relevant log output

No response

Activity

  1. added
    t/bug
    on Feb 19, 2024
  2. added
    legacy-area-perf
    area-controls-collectionview
    on Feb 19, 2024
  3. added this to the Backlog milestone on Feb 19, 2024
  4. added
    potential-regression
    on Feb 20, 2024
  5. moljac commented on Feb 26, 2024

    @moljac
    Contributor
    • could not repro

      • all tests - 0%-3%

      • manual too

    • TODO: tests on another dev box (Mac x86) with net7.0, net8.0, net9.0

    • 1000 samples - approx 1 sec each

    • tested

      • 2 macs

        • M2

        • x86 i9

      • on

        • emulators

        • pixel5 device

          I was not able

    emulator-mac-m2-net8.0.top.processor.log.txt
    emulator-mac-m2-net7.0.top.processor.log.txt

    repro sample

    AppRepro.zip

    Mac M2 pixel5 net8.0

    • crash during start (needs investigation)

      • workaround - nuke bin/ obj/
    dotnet build \
        ./net8.0/ProjectsStructureTemplate.AppMAUI.DemoSample/ProjectsStructureTemplate.AppMAUI.DemoSample.csproj \
        -t:run \
        -f:net-8.0-android
    
    adb shell top -n 1000 | grep "com.companyname" > pixel5--net8.0.top.processor.log
    

    Could not redirect output to file. Redirecting hangs.

    adb shell top -n 1000
    

    Does not even list tested app

    adb shell top -n 1000 | grep "com.companyname"                                  
    

    shows around 3% (constant)

    20790 u0_a56       10 -10  14G 227M 121M S  1.3   3.0   0:04.22 com.companyname+
    20790 u0_a56       10 -10  14G 227M 121M S  1.3   3.0   0:04.22 com.companyname+
    

    Mac M2 emulator net8.0 - OK

    dotnet build \
        ./net8.0/ProjectsStructureTemplate.AppMAUI.DemoSample/ProjectsStructureTemplate.AppMAUI.DemoSample.csproj \
        -t:run \
        -f:net-8.0-android
    
    adb shell top -n 1000 | grep "com.companyname" > emulator-2--net8.0.top.processor.log
    

    Mac M2 emulator net7.0 - OK

    dotnet build \
        ./net7.0/ProjectsStructureTemplate.AppMAUI.DemoSample/ProjectsStructureTemplate.AppMAUI.DemoSample.csproj \
        -t:run \
        -f:net-7.0-android
    
    adb shell top -n 1000 | grep "com.companyname" > emulator-2--net7.0.top.processor.log
    
  6. BaY1251 commented on Feb 27, 2024

    @BaY1251
    ContributorAuthor

    @moljac
    I noticed that my project seems to have been modified, please make sure to use <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.7" /> instead of <PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />

    Or,
    Can you directly deploy my project? I am certain that the issue introduced in the new version(8.0.7) occurred in Android 7.1, while the old version did not have this issue

  7. BaY1251 commented on Feb 27, 2024

    @BaY1251
    ContributorAuthor

    image

  8. moljac commented on Feb 27, 2024

    @moljac
    Contributor

    I noticed that my project seems to have been modified,

    yes. I have template for multi TFM tests. I tried your sample. There was some processor %, but not 20%.

    I will paste logs today.

    please make sure to use <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.7" /> instead of <PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />

    I will add those references to my projects.

    Or, Can I directly deploy my project?

    Can you? I guess you can. I did. Yes there was some % but not 20%.

    The reason I use my template is to find possible regressions if any.

    I am certain that the issue introduced in the new version(8.0.7) occurred in Android 7.1, while the old version did not have this issue

    OK. Good to know. I will test more today.

  9. moljac commented on Feb 28, 2024

    @moljac
    Contributor

    OK. I was able to repro

    with

    <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.7" />
    

    it is not 20%, but 10% original sample and 12% for my sample.

    18801 u0_a190      10 -10  14G 244M 114M S 33.6  12.3  14:57.95 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M R 33.6  12.3  14:58.96 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M R 34.0  12.3  14:59.97 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M S 34.6  12.3  15:00.99 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M S 34.0  12.3  15:02.03 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M R 33.3  12.3  15:03.05 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M S 34.3  12.3  15:04.05 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M R 34.6  12.3  15:05.08 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M R 34.3  12.3  15:06.12 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M S 33.6  12.3  15:07.15 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M S 34.3  12.3  15:08.16 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M R 33.6  12.3  15:09.19 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M R 34.6  12.3  15:10.20 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M S 34.3  12.3  15:11.24 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M R 34.0  12.3  15:12.27 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M S 34.0  12.3  15:13.29 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M R 33.3  12.3  15:14.31 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M R 35.0  12.3  15:15.31 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M R 34.3  12.3  15:16.36 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M R 34.6  12.3  15:17.39 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M S 35.3  12.3  15:18.43 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M R 35.0  12.3  15:19.49 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M S 34.3  12.3  15:20.54 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M R 32.6  12.3  15:21.57 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M R 24.3  12.3  15:22.55 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M R 24.3  12.3  15:23.28 com.companyname+
    18801 u0_a190      10 -10  14G 244M 114M S 24.0  12.3  15:24.01 com.companyname+
    
  10. BaY1251 commented on Feb 29, 2024

    @BaY1251
    ContributorAuthor

    Thank you very much. These data are sufficient to illustrate the issue, as other versions are close to 0%.

    PS:
    20% was the initial test, with a lot of interface elements to demonstrate slow interface response.
    Later, I found that the CPU was sufficient to explain the problem, so I will modify the title.

  11. changed the title [-][Android][MAUI-8.0.7] The CPU always maintains around 20%, even without any operation[/-] [+][Android][MAUI-8.0.7] CPU usage consistently remains above 10%, even without any operation[/+] on Feb 29, 2024
  12. BaY1251 commented on Apr 3, 2024

    @BaY1251
    ContributorAuthor

    can repro in Net9 pre 2?

  13. BaY1251 commented on Apr 10, 2024

    @BaY1251
    ContributorAuthor

    can repro in MAUI-8.0.20

  14. BaY1251 commented on Apr 26, 2024

    @BaY1251
    ContributorAuthor

    This may not be just a problem with CollectionView. I tried using ScrollView+HorizontalStackLayout instead, but the problem still occurred.

  15. added
    perf/general
    and removed
    legacy-area-perf
    on May 10, 2024
  16. added a commit that references this issue on May 22, 2024
    a67f795
  17. PureWeen commented on May 22, 2024

    @PureWeen
    Member

    Can you test with the latest nightly build?
    https://github.com/dotnet/maui/wiki/Nightly-Builds

  18. added
    s/needs-info
    on May 22, 2024
  19. PureWeen commented on May 22, 2024

    @PureWeen
    Member

    I tested the repro here and I no longer see any ping ponging with the latest nightly

    	<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.60-ci.net8.24272.1" />
    	<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.60-ci.net8.24272.1" />
    
  20. BaY1251 commented on May 23, 2024

    @BaY1251
    ContributorAuthor

    Yes, fixed by PR #22347

  21. added
    s/needs-attention
    and removed
    s/needs-info
    on May 23, 2024
  22. locked and limited conversation to collaborators on Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-collectionviewperf/generalplatform/androidpotential-regressions/needs-attentiont/bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions