I've been given the task of optimizing the loading speed of a page in our react redux web app.
When the page load action is triggered, there seems to be a slight freeze lasting about half a second.
After checking the profiler, everything seems fine at first glance.
Flame Graph
There are no unnecessary rerenders, and the only yellow warning I see lasts around 10 milliseconds.
Diving into the ranked tab in the profiler reveals a different story, showing that most of the time is spent in withStyles().
Ranked Graph
We are using the material-ui approach of CSS in JS via withStyles() and it seems like the use of withStyles() is significantly impacting the loading speed.
Is this really the case? Or could it simply be a matter of "I'm rendering too many things at once"?
Switching from CSS in JS back to plain CSS would require a significant effort. However, after spending an hour removing the CSS in JS, I noticed a performance improvement of about 40%. It's unclear how much of that improvement is specifically due to withStyles or just the overall process of styling elements on the page.