-
Notifications
You must be signed in to change notification settings - Fork 372
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
fix: High CPU usage in FluentDataGrid #1621
Comments
Can you reopen this? I think the current solution will create a dictionary for every combination of row type and property type. It would probably be better to have one dictionary for all expressions, and then cast the returned type. It's not as strongly typed, but will return memory usage. Also, there are some other places where there is Expression.Compile that might need work to improve caching: fluentui-blazor/src/Core/Components/DataGrid/Columns/PropertyColumn.cs Lines 53 to 102 in 902bcc8
Some research is probably needed into the best way to cache expressions. This seems like a common problem so there will be people who have solved it before. |
Expression and Compile logic has been removed from the TooltipText parameter and handling. |
🐛 Bug Report
I stress tested Aspire and had a grid with many rows that updated once a second. I noticed very high CPU usage. I profiled and found uncached usage of
Expression.Compile()
.Profile:
Likely offender:
fluentui-blazor/src/Core/Components/DataGrid/Columns/TemplateColumn.cs
Lines 26 to 27 in 4516f95
Which is called from
RenderRow
:fluentui-blazor/src/Core/Components/DataGrid/FluentDataGrid.razor
Lines 89 to 106 in 4516f95
💻 Repro or Code Sample
Create a big grid with tooltips. Have it update often.
🤔 Expected Behavior
Renders quickly.
😯 Current Behavior
Very high CPU usage.
💁 Possible Solution
Cache compiled expression.
🔦 Context
🌍 Your Environment
The text was updated successfully, but these errors were encountered: