News for hackers. Stuff that matters.
Re:Show HN: A 64-step drum sequencer I built using React and... by jeroenhd on Tuesday May 11, 2021 @09:16PM (#27125587)
I can reproduce the audio stutter by having Firefox do anything performance intensive (starting recording a performance profile does the trick nicely) and I seem to be getting severe frame drops because of garbage collection.

I think the flows of React and Redux are just not built for timing-sensitive applications like these. A lot of allocations and deallocations are taking place without any user input. Looking at the source code, the many selectors and other hooks probably has something to do with that.

Redux is also very explicit about treating objects as immutable, causing a lot of duplication as a result. For a simple web application this shouldn't be too much of a problem but again, this application is very sensitive to timing issues where 50ms of GC can cause a noticeable performance degradation.

It's not that the code is bad, it seems quite well memo-ised to get decent performance; I think it's a result of using the wrong too for the job, nothing more. Quite impressive that a framework as heavy as React can be made this responsive in my opinion.

If you run into any memory troubles, check about:performance and about:memory, you may be able to find what's causing the memory leaks.

Re:Show HN: A 64-step drum sequencer I built using React and... by nyanpasu64 on Wednesday May 12, 2021 @12:28AM (#27126586)
In the past I've found about:memory to be almost useless for pinpointing leaks. It's segmented into processes and types of allocations, and only the deeply nested sub-entries say which tab the memory belongs to. And even then, I don't know whether Firefox, the site, or an extension is causing memory bloat. I end up resorting to just blindly closing tabs or restarting the browser.

I might try about:performance more, but in the past I recall it being similarly almost useless for pinpointing sites eating CPU.