This blog post delves deeper into the slow launch times of some Mac applications, particularly those built with Electron. It revisits and expands upon a previous investigation, pinpointing macOS's handling of code signatures as a significant bottleneck. Specifically, the codesign
utility, used to verify the integrity of app binaries, appears to be inefficient when dealing with large numbers of embedded frameworks, a common characteristic of Electron apps. While the developer has reported this issue to Apple, the post offers potential workarounds, like restructuring apps to have fewer embedded frameworks or leveraging notarization. Ultimately, the author emphasizes the significant performance impact this issue can have and encourages other developers experiencing similar problems to report them to Apple.
This blog post, a follow-up to a previous exploration of slow application launch times on macOS, delves deeper into the intricacies of application startup and the reasons behind perceived sluggishness. The author, drawing from continued investigation and reader feedback, refines their initial understanding and offers a more nuanced perspective on the factors at play.
The primary focus of this follow-up is the impact of dynamic linker (dyld) shared cache invalidation. The author elucidates that modifications to system libraries, frequently introduced through software updates, necessitate the rebuilding of this cache. This rebuilding process, occurring in the background during the initial launches of applications after an update, can introduce noticeable delays. The author emphasizes that this slowdown is not inherent to the applications themselves, but rather a consequence of the system's need to reconcile changes in its foundational components.
The post clarifies that the previously observed slowdowns were not solely attributable to the dyld cache rebuild. Instead, the author identifies the interaction between the cache rebuild and the Transparency, Consent, and Control (TCC) framework as a significant contributor to the prolonged launch times. TCC, responsible for managing user permissions for sensitive operations like accessing files or the camera, performs checks during application startup. When coupled with a dyld cache rebuild, these TCC checks can compound the delay, creating a more perceptible performance impact.
The article explains that while TCC's verification process is essential for system security, its execution during a dyld cache rebuild exacerbates the slowdown. The author speculates that this might be due to TCC needing to re-establish its internal state or re-verify permissions against the newly rebuilt cache. This confluence of factors creates a scenario where applications appear to launch significantly slower than usual.
The post concludes by reiterating that these launch delays are typically transient, resolving once the dyld cache rebuild and TCC reconciliation are complete. It reinforces the idea that the slowdown is not a flaw in individual applications, but rather a byproduct of necessary system maintenance occurring in the background. Furthermore, it highlights the complexities of system-level operations and their subtle yet potentially significant impact on application performance. The author encourages patience during these periods of system adjustment, assuring users that normal launch speeds should return once the background processes are finalized.
Summary of Comments ( 1 )
https://news.ycombinator.com/item?id=43858970
The Hacker News comments discuss the linked article about slow Mac app launches, focusing on the impact of poorly optimized or excessive use of frameworks and plugins. Several commenters agree with the author's points, sharing their own experiences with sluggish applications and pointing fingers at Electron apps in particular. Some discuss the tradeoffs developers face between speed and cross-platform compatibility. The overhead of loading numerous dynamic libraries and frameworks is highlighted as a key culprit, with one commenter suggesting a tool to visualize the dependency tree could be beneficial. Others mention Apple's role in this issue, citing the increasing complexity of macOS and the lack of clear developer guidelines for optimization. A few comments dispute the article's claims, arguing that modern hardware should be capable of handling these loads and suggesting other potential bottlenecks like storage speed or network issues.
The Hacker News post "Why some Mac apps launch slowly: A follow-up" has generated a number of comments discussing the original article's findings and offering additional perspectives on macOS application launch performance.
Several commenters discuss their own experiences with slow-launching applications, corroborating the article's claims. One commenter highlights the frustration of waiting for apps like Slack and Docker to start, pointing out the perceived discrepancy between the speed of modern hardware and the sluggishness of some applications. Another commenter mentions slow launch times with Adobe apps, echoing a common complaint about the performance of these applications on macOS.
Some users delve into more technical aspects. One comment explores the complexity of application startup, mentioning the numerous frameworks, libraries, and plugins that need to be loaded. This commenter suggests that the intricate interplay of these components contributes significantly to launch times. Another technical comment touches on the impact of notarization, a security measure introduced by Apple, and how it might introduce overhead during the startup process. However, this is countered by another user who argues that notarization is unlikely to be the primary culprit.
The discussion also turns to potential solutions and mitigation strategies. One commenter suggests using native macOS APIs whenever possible, arguing that this can improve performance compared to cross-platform frameworks like Electron. Another user proposes using a tool to analyze startup times and identify bottlenecks.
Several commenters express their appreciation for the original article, thanking the author for shedding light on a persistent issue. They praise the in-depth analysis and the clear explanations provided.
A recurring theme in the comments is the desire for Apple to address these performance issues. Some users suggest that Apple could provide better tools for developers to optimize their applications or improve the underlying macOS framework to enhance overall launch speed. One commenter even expresses skepticism about Apple's willingness to tackle the problem, suggesting that the company might prioritize other aspects of the operating system.
Finally, a few comments offer alternative explanations for slow launch times, such as network dependencies or the presence of antivirus software. One commenter also points out the role of hard drive speed, noting that using an SSD can drastically improve launch times compared to a traditional hard drive.