I'm working on a gant-ish scheduler using React. The Scheduler is comprised of SVGs which are generated by the data. The data is manipulated by the mouse events and business logic.
Recently, performance has become an issue (likely due to poor coding in general), so I decided to profile it using Chrome's profiler (the same anomaly occurs in multiple other web browsers, see below).
However, I noticed immediately that performance significantly improved whilst I was running the profiler!
This doesn't make much sense to me at all since normally profilers are expected to reduce performance.
Here is a video recorded at 60fps with Chrome's fps counter with and without profiling the code.
As you can see there is a jump from about 9fps without the profiler to 40fps with the profiler running.
I've got a feeling its related to mouseevent frequency, but Google hasn't helped much (mouse move events are an RxJs Stream which is subscribed to by the scheduler).
Any ideas?
Still shots of profiler results:
Zoomed out

Zoomed in

"BubbleCopy" and the one to the right are made by me. The ForceUpdate() is called manually at the end of each cycle if the mousemovement causes a state change.
(I've intentionally chosen to do this over using setState or prop changes since I need to change state more often than I require a full re-render and require a deeper object structure. Furthermore, in further testing I've separated rendering to occur after a set period, I've separated mouse events to poll the mouse position after a set period, and have I've changed these periods to co-incide/multiples/random to no avail.)
Additional Notes: All Chrome extensions were disabled in this test.
EDIT: Testing across various browsers:
- Chrome - Profiling improves performance
- Edge - Profiling improves performance
- Internet Explorer - Lol.
- Firefox - Profiling improves performance, but base performance is better overall.
UPDATE: The performance issues were caused by using JSON.parse(JSON.stringify(bubble)) to deep-copy the "bubbles". Changing this to a recursiveDeepCopy function greatly increased the performance.
This doesn't explain why profiling the code made it a tonne faster, nor does it explain why firefox had no performance issues, but hopefully someone with a similar problem in the future will encounter a similar fix.
Please comment if anyone ever figures this out.