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

Upgrade to Avalonia 11.0.0-preview6 #318

Merged
merged 1 commit into from
Mar 30, 2023

Conversation

aldelaro5
Copy link
Contributor

I am leaving this here because I tried to upgrade it and while everything seemed fine and builds, I am hitting a very bad performance issue which profiling seems to suggests that the GC is put under a lot of pressure which didn't happen with preview5. The CPU usage is much higher than it should and the app becomes very unresponsive.

Just in case I can't get anywhere so my branch is there.

@danipen
Copy link
Collaborator

danipen commented Mar 22, 2023

Could you please share your profiling data? What are the hot paths?

@danipen
Copy link
Collaborator

danipen commented Mar 22, 2023

How do you reproduce the bad performance? Do you experience it in your application or just in the AvaloniaEdit demo project?

@aldelaro5
Copy link
Contributor Author

Could you please share your profiling data? What are the hot paths?

This is how I got there, I am unfortunately not experienced with profiling so I actually have a hard time figuring out where are the hot paths. Rider doesn't really show me something that jumps out to me. What I do know is the GC has a lot more pressure,
preview6:
Screenshot from 2023-03-22 12-04-25

preview5:
Screenshot from 2023-03-22 12-05-43

How do you reproduce the bad performance? Do you experience it in your application or just in the AvaloniaEdit demo project?

The demo project. I just needed to run it to see the issues, it's incredibly unresponsive immediately and all the time.

@danipen
Copy link
Collaborator

danipen commented Mar 22, 2023

Quite good perf under windows for me ... Are you trying windows OS?
perf

@danipen
Copy link
Collaborator

danipen commented Mar 22, 2023

@aldelaro5 do you experience the same bad perf if you execute the application directly without the debugger?

@aldelaro5
Copy link
Contributor Author

I am on arch linux, I have access to a windows vm I can try that later, but in digging more, I might have a hint after analysing more profiling:

Screenshot from 2023-03-22 12-53-12

This path is notably hot in preview 6, but not in preview 5. I also noticed the RunLoop has a lot of "lock contention" which sounds like this hot path could be stalling the UI thread?

It does seem to involve skia, maybe it's a linux specific issue?

@danipen
Copy link
Collaborator

danipen commented Mar 22, 2023

Could be a linux specific issue, yes.
cc/ @Gillibald

@Gillibald
Copy link
Contributor

Is MatchFamily called more often than TryCreateGlyphTypeface?

@aldelaro5
Copy link
Contributor Author

Ok it seems to be an avalonia issue.

This pr AvaloniaUI/Avalonia#10455 is the one that seems to have introduced this problem because it seems if I try ci builds before this pr, the perf comes back, but if I try the ci build of this pr, it reproduces.

@aldelaro5
Copy link
Contributor Author

Is MatchFamily called more often than TryCreateGlyphTypeface?

I think it's more saying that either MatchFamily is slow OR that it ends up being called using this path so much that this path as a whole is slow. Given the pr I posted above seems the most suspicious, it's most likely the later it seems?

SKProCH referenced this pull request in AvaloniaCommunity/Material.Avalonia Mar 27, 2023
…se of ShowMeTheXaml (and actually AvaloniaEdit)
@Numpsy
Copy link

Numpsy commented Mar 28, 2023

fwiw, I've given it a try in both a Windows desktop app and in web assembly, and it seems to work ok, with perf about the same as the preview 2 release

@aldelaro5
Copy link
Contributor Author

I just filed an avalonia issue about this because I noticed the same degradation in a completely different context. I can however confirm it doesn't seem to affect Windows so this seems to be a Linux specific issue.

@Numpsy
Copy link

Numpsy commented Mar 30, 2023

So, is this perf issue a blocker to getting a preview 6 compatible AvaloniaEdit build released, or as the issue is in Avalonia can we still get a new build here whilst waiting for that? (I just think a new compatible build would be nice for testing other things is all(

Copy link
Collaborator

@danipen danipen left a comment

Choose a reason for hiding this comment

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

LGTM

@danipen danipen marked this pull request as ready for review March 30, 2023 17:01
@danipen
Copy link
Collaborator

danipen commented Mar 30, 2023

I think we can merge.

@danipen danipen changed the title WIP: Upgrade to Avalonia 11.0.0-preview6 Upgrade to Avalonia 11.0.0-preview6 Mar 30, 2023
@danipen danipen merged commit b036472 into AvaloniaUI:master Mar 30, 2023
@Numpsy
Copy link

Numpsy commented Mar 30, 2023

Thanks

@bouyeijiang
Copy link

The Linux mint system I am using also has the same issue, the window system is fine

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.

5 participants