-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Description
Hello guys, I would like to discuss performance problems i met with my Blazor App.
It will be a very long text with a project example to illustrate this, so please read with attention before respond.
I rewrite since one year a silverlight app in blazor, and i notice since the begining some performance issues on some heavy views.
The behavior is really bad, its a completely browser freezing and nothing respond (not only the app, all the browser, the loading effects in css are also freeze).
On the worst case of my app (navigate to a really big view to another), this freeze can take 12 seconds which is not just not acceptable.
I recheck the way of my components react before open this issue (be sure my components no render too many times) and on my side there is no problem, they are renders only one time even with 10 seconds freeze.
I precise i have this behavior only in webassembly, my app work also on server side and on this mode, the app is really more faster and i don't have this "freeze" effect (for example the 12seconds freeze in webassembly are transform in 1 or 2 second but this time make sense considering the amount of data shown, and the browser not freeze).
So i try to create a sample project to understand whats the problem : blazor ? the way i use it ? other ?
You will find the sample here https://github.com/julienGrd/BlazorTest
This sample have 4 views, each view show the same data, 3 link showing a different table of 1000 lines, but by different ways.
The question is not to know if 1000 line in a table is a good idea because obviously is not but observe the performance between the different ways
-
FetchData V1 : In this view i use a "advance" table component insipired but what i create on my app but really more simple. This component authorise the selection and reordering by clicking on the header. To make this possible, i had to play with CascadingValue to provide a way for my rows and my columns to communicate with the parent, the grid.
At this time i want to say the way i do it is quite of ugly but it seem i can't do better at this time, there is some issues opened here wich speak about the problems we have to make a good and efficiency communication between components. For example provide a way in my Grid component to directy have a IEnumerable as a parameter.
When i change Page on this view, i note on my laptop an average of 4 second freeze. -
FetchData V2 : Its the same than the V1 except i inject the parent with classic parameter and not cascadingParameter. I was thinking was the problem, it seem not, i observe the same performance (average of 4 second)
-
FetchData Simple Table : In this View, I use a different component to render only a simple table without specific behavior. And the things become interesting. I notice changing Page take only 1 second on this View. So it seem it more the way blazor deal with my grid component the problem than the amont of data rendered.
-
FetchDataJs : In this view i dont use at all blazor system but i do everything in js to see the "difference". I notice on this view an average of 1 second to change page which is close to the fetch data simple table.
So the question is : why the first two view take 4 second for changing page and the others only 1 second ? i put some console.writeline in the OnAfterRender of my components to be sure everything is rendered one time.
we can also notice something when browser freeze in the browser console : some webassembly Garbage collector log like this
L: GC_MAJOR_SWEEP: major size: 9440K in use: 19819K
L: GC_MAJOR: (LOS overflow) time 31.00ms, stw 31.02ms los size: 14256K in use: 11098K
L: GC_MINOR: (Nursery full) time 26.06ms, stw 26.10ms promoted 952K major size: 15920K in use: 14653K los size: 23392K in use: 20592K
Im not able to understand the value provided by this log, webassembly is a black box for me.
for example on my app when a 10 second freeze happen i have these values
L: GC_MAJOR_SWEEP: major size: 16688K in use: 34623K
L: GC_MAJOR: (LOS overflow) time 59.83ms, stw 59.98ms los size: 4240K in use: 2789K
L: GC_MINOR: (LOS overflow) time 0.81ms, stw 0.88ms promoted 0K major size: 16688K in use: 6798K los size: 4240K in use: 2789K
Thanks in advance for your help, for me it actually really a big deal because for now its a no go to put in production after one year of work.
I precise my app don't have table with 1000 rows but sometimes until 250, with 15 columns, and a content inside cell really complex, additionate with advance table scenario like grouping, filtering, resizing, etc. so my 10 seconds freeze are not really surprising if a 1000 row simple table put 4 seconds to show. It the actual behavior with the silverlight app and this last one can easily take 1000 rows like this without specific problems, so the company i work for will not accept answers like "there is too many data"