How to dramatically improve Firefox performance on macOS?



The web browser 'Firefox' regularly delivers updates that include feature improvements and bug fixes. Gabriela Svelt, a member of the Firefox development team, explains how

Firefox 103 , released in July 2022, improved performance under high load in the macOS environment.

Improving Firefox responsiveness on macOS - Mozilla Hacks - the Web developer blog
https://hacks.mozilla.org/2022/10/improving-firefox-responsiveness-on-macos/

Firefox versions prior to Firefox 103 had a problem that ``performance under high load is significantly reduced in the macOS environment''. According to Mr. Svelt, Firefox 103 succeeded in suppressing performance degradation by slightly changing the memory allocation mechanism.

Firefox manages memory using an allocator customized from the open source memory allocator ' jemalloc '. Firefox's allocator uses native APIs for each OS to efficiently lock during parallel processing. As this lock API, OSSpinLock was used in macOS.

OSSpinLock was also able to run applications faster and consume less power when lock cycles were short. However, long lock cycles tend to degrade performance, and it is also known that performance degrades significantly during high-load processing. Due to this problem, the old Firefox had a problem that it stopped responding when executing high-load processing.

Apple is aware of the problems with OSSpinLock and provides ' os_unfair_lock ' as an alternative API for OSSpinLock. However, automated testing after implementing os_unfair_lock in Firefox showed a performance drop of about 30% . After that, as a result of analyzing the cause of the performance degradation, the unpublished function ' os_unfair_lock_with_options () ' and the unpublished options ' OS_UNFAIR_LOCK_DATA_SYNCHRONIZATION ' and ' OS_UNFAIR_LOCK_ADAPTIVE_SPIN ' that Apple did not describe in the document were discovered, and by using those unpublished functions It is said that the deterioration of performance was suppressed.



Regarding the use of undocumented private functions, Mr. Svelt said, ``Private functions may not be available in future versions of macOS, so we perform regular tests on beta versions of macOS. Please,' and emphasizes that the solution in Firefox is an unofficial method.

In addition, on the news sharing site HackerNews, ``When I used Firefox a few days ago, I could feel the speedup.I felt it was faster than Chrome on some sites.The Firefox development team's appropriate response and Comparing the nonsense of Manifest V3 raised by the Chrome development team, I can't find a reason not to move to Firefox.” Many comments praising the Firefox development team have been posted .

in Software, Posted by log1o_hf