Base solution for your next web application
Open Closed

Sluggish performance SPA #5257


User avatar
0
TimMackey created

If I add a function to the DashboardComponent class:

console_log(index: number) {
        console.log('DashboardComponent console_log ' + index.toString());
    }

... and add ngClass to the first line of 'dashboard.component.html' like this:

<div [@routerTransition] id="TenantDashboard" [ngClass]="console_log(1)">

... I am able to observe in a browser debug console window that the page is being refreshed thousands of times per minute when there is no activity. Why is this happening? Is there a setting to limit page updates to refresh only if something changes?

I need to limit page updates because I have a large SPA with dozens of dynamically loaded child components, each of which has another half-dozen dynamically loaded child components. My system is becoming very sluggish. Task Manager reports CPU usage of 21% for the SPA, and I have many more components yet to be added. What techniques can I adopt to make my SPA robust? I want to avoid breaking my SPA into dozens of small SPAs to resolve performance issues. Current AspNetZero revision: 5.3


30 Answer(s)
  • User Avatar
    0
    TimMackey created

    @ismcagdas,

    I merged with my project with Ver 5.6. The performance is still unacceptably sluggish.

    I will send my project to <a href="mailto:[email protected]">[email protected]</a> so that you can observe the performance first-hand, and hopefully diagnose the problem and devise a solution.

    Thank you.

  • User Avatar
    0
    TimMackey created

    @ismcagdas,

    I discovered 16 instances of

    @HostListener('window:resize', ['$event'])
        onResize(event?) { ... }
    

    being created in my code. Modifying my code for a single instance has markedly improved performance. Please keep the changes for Version 5.6.0 related to this issue.

    This issue can be closed. Thank you.

  • User Avatar
    0
    ismcagdas created
    Support Team

    @TimMackey, thank you for letting us know, I couldn't identify the problem. Could you share your modification to source code ? We can implement the same in AspNet Zero.

  • User Avatar
    0
    TimMackey created

    The problem was in my code. Sorry for the initial post not making that clear. I have edited the original post to clarify the source of the error was mine.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks :)