mrpmorris / Fluxor

Fluxor is a zero boilerplate Flux/Redux library for Microsoft .NET and Blazor.
MIT License
1.22k stars 139 forks source link

Fluxor Redux Dev Tools eating ram #465

Closed pmunozroa closed 3 months ago

pmunozroa commented 6 months ago

Hello, I have been working with Fluxor this week, and just testing my app today, I was in panic when I saw the resources used by the applicaiton, then I check each change that I made, finally I found out it was DevTools, Framework and nuget used: .NET 7 Fluxor Version="5.9.1" Fluxor.Blazor.Web Version="5.9.1" Fluxor.Blazor.Web.ReduxDevTools Version="5.9.1" Newtonsoft.Jso" Version="13.0.2" Radzen.Blazor Version="4.20.0" I tried to take a snapshot, but for some reason, it was crashing

image
Hona commented 6 months ago

Hey, I had similar problems, but mainly with how long it took to blur from a field (approaching 800ms for a simple state update)

Dev Tools is the culprut. 2 main causes, the stack trace & the json serialiser.

Make sure you have the following as I have and let me know if it works:

options.UseReduxDevTools(rdt =>
{
    // Not sure if this one is needed
    rdt.Latency = TimeSpan.FromSeconds(1); // Default 50, maybe improves dev tool perf

    rdt.UseSystemTextJson(_ =>
        new System.Text.Json.JsonSerializerOptions
        {
            PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase
        }
    );
    //rdt.EnableStackTrace();
});
Hona commented 6 months ago

Okay I did more testing. You can keep the stack trace & default Latency. STJ is the only change needed for my perf fix.

mrpmorris commented 5 months ago

Changing the PropertyNamingPolicy sped it up?

Hona commented 5 months ago

In my Blazor app there was a massive slowdown with default dev tool settings or explicitly saying use Newtonsoft.

When I changed the serialised to use SystemTextJson it went away. The naming policy is just extra.

mrpmorris commented 3 months ago

Only STJ is supported as of V6