The development team took some time earlier this year to investigate Cinnamon’s performance when it comes to launching applications.
It’s really hard to measure the actual time between the moment the mouse button is clicked and the moment the new application is rendered on the screen, with its window properly mapped, and the mapping window animation completely finished. It’s not something that can be timed accurately, yet we all agreed within the development team to say that it either “was”, or “felt” snappier in MATE and Xfce.
At the time, we didn’t know if it was just down to perception (animations, composition), or a feature (registering new apps with the session for instance), or a performance issue.
We developed a little script and a method to measure how long it took to flood the desktop environment with the creation of 200 windows. We could then measure the time reported by the script to build these 200 windows, and the time it actually took the desktop environment to recover from it and have these windows placed/mapped correctly and ready to be interacted with.
Both measures were significantly higher in Cinnamon than in other desktops.
Here’s how Cinnamon compared to Metacity:
- Windows build time: 1s in Metacity, 4s in Cinnamon.
- Recovery time: 6s in Metacity, 22s in Cinnamon.
From there, our work was simple. We had to find what made Cinnamon slower and get these numbers down.
We first started by elimination and identified that the following suspects had nothing to do with it:
- HiDPI support
- Theme complexity
We then measured Muffin on its own (Muffin is the library used by Cinnamon to implement the window manager, but it can also be run on its own, without the rest of Cinnamon) and found out that although the performance was better than in Cinnamon, the numbers were higher than with Metacity. We therefore had performance issues both in Muffin and in Cinnamon.
In Muffin, we were able to apply two upstream commits from GNOME which helped tremendously.
In Cinnamon, 4 commits fixed bottlenecks in the window list and the panel launchers.
The technical analysis is available at https://github.com/linuxmint/Cinnamon/pull/7251.
After these changes the numbers were down and Cinnamon was just as fast as Metacity to build the 200 windows and recover.
In addition to this, the team also took the opportunity to improve the window animations. Although they weren’t responsible for any delay, they had an impact on perception. The new animations look cleaner and along with the performance improvements they make Cinnamon feel snappier than before.