I'm struggling with CPU performance and memory optimization for a macOS app I'm developing.
I'm writing to ask for advice!!!
The app I am developing consists of continuous real-time calculations and graphical elements. If I monitor the individual components, the CPU usage is as follows
FetchAudioData (captures real-time data with Timer & performs calculations): 20%-30%. MEMU (graphics operation 1): 30% to 40%. FullScreen (graphics task 2): 20% to 40%. I run the app and see a CPU load of 50% to 100% consistently, based on 600% full capacity.
However, after 3-4 hours of operation, the CPU utilization suddenly drops to around 10%. (It's hard to determine the exact cause because it's hard to monitor continuously during this time)
Additionally, I aware of some memory issues and are dealing with them, but they don't appear to be fatal leaks, so I relegated them to lower priority tasks for now.
At a crossroads, Should I prioritize code optimization, fix the small memory issue first, spend three to four hours of close monitoring, or perform a deeper understanding of the Mac system?
The analysis process through Profile in Instruments is also tricky in terms of catching the exact moment of a sudden change in CPU utilization.
I'm looking for advice from people who have some experience with performance/memory optimization in iOS environments, not necessarily macOS.
I'm also wondering why the thread count in the picture goes into the 3000s after 3-4 hours. I'm also wondering if this is an issue with asynchronous processing.
Any advice would be greatly appreciated in the comments.
Thanks.