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

Window initialization slows down after upgrade to 9.0 #995

Closed
AndersChen123 opened this issue Dec 21, 2021 · 10 comments
Closed

Window initialization slows down after upgrade to 9.0 #995

AndersChen123 opened this issue Dec 21, 2021 · 10 comments
Assignees
Labels
Milestone

Comments

@AndersChen123
Copy link

After upgrading from 8.0.3 to 9.0, the window initialization speed slows down.
v8.png
This is the initialization speed of the window using 8.0.3.

v9.png
This is the initialization speed of the window using 9.0.

The window content is simple, with just four ribbon tabs and an OxyPlot chart.
It was about 700 milliseconds slow after the upgrade.


Environment

  • Fluent.Ribbon v9.0
  • Windows 10 pro 21H2
  • .NET Framework 4.7.2
@batzen
Copy link
Member

batzen commented Dec 21, 2021

It shouldn't be that much slower.

Could you either share the profiling files or expand the call trees all the way down and then use "Copy Subtree to clipboard", put the results into text files and attach those to this issue?

FYI: you don't need to upload images on an external host, you can just drag&drop or copy&paste them in the text area here.

@AndersChen123
Copy link
Author

Thank you for your reply.
The attachment is profiling files. The file format is 7z, I changed it to zip for uploading.
v9.zip
v8.zip

@batzen
Copy link
Member

batzen commented Dec 21, 2021

That's quite strange. Something seems to run twice. As the main time consumer is OnIsCheckedChanged from ToggleButtonHelper which results in the content of some element to be changed.
From what i can tell it looks like the ribbon is minimized/expanded multiple times during loading.

Could you share your application, ideally with it's source code.
If you don't want to share it publicly, we can figure out a way to do it privately.

@AndersChen123
Copy link
Author

Sorry, this is an internal project of our company, so the code cannot be sent.
I create a demo to reproduce this problem. Although the slowness is not as obvious as the other project, it is also slower. Hope this helps you diagnose the problem.

Run the project and double-click the chart to open the child window. I started profiling when I opened the child window.
FluentRibbonTest.zip

@batzen
Copy link
Member

batzen commented Dec 21, 2021

I can't see any performance problems in the provided test application, at least on my machine.
See my profiling results:
8.0.3.dtt.zip
9.0.0.dtt.zip

What's strange is that performance seems to be around 10 times slower on your machine.

@AndersChen123
Copy link
Author

The slow part is mainly in AssociatedObject_SourceInitialized and OnIsCheckedChanged.
The OnIsCheckedChanged method in the demo executes quickly, but it is very slow in another project, probably because there are many buttons and menu items.
I suppose it was caused by the IsChecked property of Expand the Ribbon menu item changed many times. But I did not find what caused it to change many times.

@batzen
Copy link
Member

batzen commented Dec 22, 2021

Do you have set the GroupName on some ToggleButton or MenuItem by accident?
As the called method ToggleButtonHelper.UpdateButtonGroup only calls SetCurrentValue if there are other buttons with the same group. Maybe you have a second button that's bound to IsMinimized and that causes the toggling.
The toggling also seems to activate some style trigger which changes the content of something. The default style from Fluent.Ribbon does not change the content on triggers.

If you have Rider you can set a breakpoint inside the ToggleButtonHelper.UpdateButtonGroup to see if and which buttons are in the same group.

@AndersChen123
Copy link
Author

Code from RibbonTabControlControlTemplate
<Fluent:MenuItem GroupName="ShowRibbon" Header="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.ExpandRibbon, Mode=OneWay}" IsCheckable="True" IsChecked="{Binding IsMinimized, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:StaticConverters.InverseBoolConverter}}" Visibility="{Binding CanMinimize, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource boolToVisibilityConverter}}" /> <Fluent:MenuItem GroupName="ShowRibbon" Header="{Binding Source={x:Static Fluent:RibbonLocalization.Current}, Path=Localization.MinimizeRibbon, Mode=OneWay}" IsCheckable="True" IsChecked="{Binding IsMinimized, RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding CanMinimize, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource boolToVisibilityConverter}}" />

The problem is related to the IsMinimized property of RibbonTabControl. If I delete the IsChecked binding in the above code or only delete the InverseBoolConverter, the problem is gone.
But now I have no idea how to fix it.

@batzen
Copy link
Member

batzen commented Dec 23, 2021

You are totally right. That's my mistake. The menu items shouldn't have a group name. Argh...

@batzen batzen self-assigned this Dec 23, 2021
@batzen batzen added this to the 9.0.1 milestone Dec 23, 2021
@batzen batzen closed this as completed in 5cd20f1 Dec 23, 2021
@batzen
Copy link
Member

batzen commented Dec 23, 2021

Thanks for reporting, providing information and finding the culprit.. Will release version 9.0.1 next week.
If you need a fixed version via nuget ASAP you can use the appveyor nuget feed till i release to nuget.org.

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

No branches or pull requests

2 participants