MuseScore
MuseScore copied to clipboard
High CPU usage even when idle (34%)
On a linux laptop, with the appimage for musescore 4.0alpha2. My laptop is from 2019 and was high end then (Dell XPS13).
I observe that MS4 uses a lot of CPU for scores with many instruments, even when idle, even with a new empty score.
To reproduce, I start MS4, select "New score", choose "symphonic orchestra". I wait about 10 seconds for Musescore to load all of its audio samples, minimize the window (to be sure it receives no mouse/keyboard event), and run "top" (for monitoring cpu usage). It tells me MS4 is using about 34% of my CPU, even though it does absolutely nothing.
If I do the same thing, but with a simple staff instead of a symphonic orchestra, Musescore's CPU usage is at about 8%, which is smaller but still big,
I expect a program such as Musescore to use CPU only when it receives some UI event, do some computation or perform some playback. When it is idle, it should use no CPU at all and should not drain one's battery: one should be able to have an unused opened musescore in some window without any bad consequence.
On a related note, I remark that when MS4 is running, the sound system on linux (pipewire for my distribution) uses 4 to 5 % of CPU instead of 0, even if no sound is being played. This tells me that MS4 is continuously sending some data to the sound server; in other words, MS4 is continuously playing some silence. For the same reason as above, I expect any program to send data to the sound server only when actually playing some sound. I am not sure whether this is an independent issue or is related to the previous issue.
As a comparison point, Musescore 3.6.2 on the same computer with an empty, freshly created, symphonic orchestral score uses about 4% CPU when idle. Still too big in my opinion, but much better than 34%. Pipewire (the sound server) uses hardly any CPU at all: MS3 is not sending a continuous stream of silence when not playing.
Can you upload your system specs?
Sure;
CPU: 8 cores, "Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz" RAM: 16 GB Graphics: Intel Corporation WhiskeyLake-U GT2 [UHD Graphics 620] Screen resolution: max 3840x2160, actually using 1920x1080 for some reason. Storage: 512GB of ssd drive. Distribution: up to date fedora 35, running X and KDE (instead of the default wayland and gnome)
I am not sure of what more you actually want to see...
@DmitryArefiev - would be good to investigate when you have time. Assigning a P2 for now.
@DmitryArefiev - would be good to investigate when you have time. Assigning a P2 for now.
@Tantacrul I've tried on my week laptop Asus X415Ja (Pentium Gold 6805) with Linux Mint 20.2.
MS4 takes more than MS3 but it's still not ~34%
On idle with Symphonic Orchestra template, MS4 uses 5-6% and MS3 uses 1-2%
@EB2000 Can you try again please in the latest master?
Hi! I have just downloaded and run MuseScoreNightly-202209150459-master-5765547-x86_64.AppImage I see the same behaviour as alpha2, with slightly different numbers.
- With symphonic orchestra, about 30% cpu
- With a single treble key, about 8% cpu (same condition as above: I launch, create a new partition and iconize the window. The numbers given are fore the mscore-portable process as reported by top; there is an extra 4% cpu usage from pipewire, the sound server: musescore seems to be continuously sending some silence to the sound server.)
Excuse my naive question, but why should it be using any cpu at all while waiting for the next event? For instance, gimp uses 0% cpu when idle. What is musescore doing?
OS: Linux Mint 20.1, Arch.: x86_64, MuseScore version (64-bit): 4.0.0-3065438645, revision: github-musescore-musescore-e563c08
Playing back the attached score: specimen_playback.zip
- In MS 3.6.2: The system monitor shows 5% CPU usage.
- In the current nightly: The system monitor shows up to 40% CPU usage.
Hi, I just tried MS4 on a different, more recent, linux fedora computer. I tried the most recent nightly (202210030446-master-3d92b93) and the same version (202209150459-master-5765547) as in my previous post. I still observe the same issue: for an idle musescore on an empty freshly created score, I get
- around 30% cpu for mscore, 5% for pipewire and 2% for pipewire-pulse for a symphonic orchestra score
- around 7% cpu for mscore, 5% for pipewire and 2% for pipewire-pulse for a single treble clef score This newer computer is a desktop with a 16 core Intel i7-10700 CPU @ 2.90GHz and 32GiB of ram.
Hi, I have the same problem with approx. 1,5-2Go Ram used, CPU 95% for a score with less than 20 instruments. Threat for the sound system increase too. MS3 run perfectly with very low process needed. In fact, MS4 is unusable in its current state :(
My config : RAM 16 Go, CPU i5 vPro, ThinkPad L450, xfce4 MS4 OS: Ubuntu 22.04.1 LTS, Arch.: x86_64, MuseScore version (64-bit): 4.0.0-223472159, revision: github-musescore-musescore-5485621
Is there some news about this issue ? Thanks,
@skuntzmann Can you try the latest release build (4.0.1) please?
Hi, I have the same problem with approx. 1,5-2Go Ram used, CPU 95% for a score with less than 20 instruments.
Is this happen even when idle or during playback? Also, MuseSounds are enabled for that scores or that happens with MS Basic?
Thanks!
Just tested with 4.0.1
My score is orchestral = 24 parts. RAM = 1,3Go used for musescore in all the cases bellow.
With MuseSound During playback : CPU 60% Without playback : CPU 7% Thread for pulseaudio for both = 2%cpu There is a latency each time a enter notation or click on a button to open a window or section of the soft.
With MuseScore Basic During PLayback : CPU 33% Without playback : CPU 7% No particular latency, behavior ok.
Thanks
@skuntzmann Thanks for your testing! I guess if CPU takes 7% without playback it's fine regarding the current issue (initially it was 34%) MU4 takes more resources than MU3
There is a latency each time a enter notation or click on a button to open a window or section of the soft.
I've logged a separate issue for this #15936. We have some performance issues with Muse Sounds which are in progress yet.
In fact, MS4 is unusable in its current state :(
As I understand, this happens only with Muse Sounds. With MS Basic you don't have such problems?
@skuntzmann Can you also check if your Muse Sounds are updated? (just open Muse Hub)
Hi!
I just downloaded MuseScore 4.0.1, on the same computer as for the initial report. I removed the file /usr/lib/libMuseSamplerCoreLib.so and made sure MuseHub was not running, so that only MS Basic would be available. I run MuseScore, create a new (and empty) ochestral score, minimize the window and wait a bit.
Musescore 4.0.1, while doing nothing, uses around 26 to 30% of CPU, and pipewire an extra 3 to 4%.
There might be an issue with Muse Sounds, but it's a separate issue. As I said, I suspect MuseScore of sending a continuous stream of silence on the sound system.
Éric Brunet
Hi! That's strange.. I still have 3-4% even with MuseSounds..
Maybe you can try the last 4.0.2 - https://github.com/musescore/MuseScore/actions/runs/4050939291
I have just downloaded MuseScoreNightly-230340504-4.0.2-c229b14-x86_64.AppImage
. I am running it, creating a new partition and do nothing else.
- For a "symphonic orchestra" score (25 instruments), musescore uses up around 48% of CPU
- For a "classical orchestra" score (12 instruments) it is about 28%
This is with or without musesound.
I can reproduce. 20-25% of CPU on "symphonic orchestra"
@skuntzmann @DmitryArefiev
Maybe I found the "problem". The problem is that you are using different programs to track the percentage of CPU usage. "Top" and "System monitor"
Top shows by default the total consumption of all virtual cores for each program. To change this way of calculating CPU usage press uppercase 'i' (Shift+i) in the terminal with 'top' running.
Or use "htop".
It is true that there are several ways to measure CPU usage; however
- independently of the metric, when the program is idle, Musescore 4 CPU usage is about 8 times Musescore CPU usage
- independently of the metric, when the program is idle, Musescore 4 CPU usage for an empty symphonic score is about 4 times the CPU usage for a simple staff.
- independently of the metric, the CPU usage of any idle program (no rendering, no music playing, no animation, no event processing) should be exactly zero, and Musescore's is not.
MS4.1 now uses less CPU cycles when idle than before, but still more than MS3 (around 6% for MS4 vs. around 2% for MS3 on my computer for a voice+piano score).
For a new score with the “Symphony Orchestra” template, I get an idle CPU usage of 11 – 12% on MS4 (versus ~2% on MS3). Better than before, but still concerning.
For all of the tests, I’m only using MS Basic.
I just tested the latest nightly on Ubuntu. While 4.1.1 was still causing 100% CPU usage when idle, the latest nightly is down at 10-15% which is great.
I haven't tried in a while on my fedora linux computer. Note: this is a different computer from my original report, so numbers don't compare. Here's what I get:
- on Musescore 4.1.1 as bundled in the official AppImage (MuseScore-4.1.1.232071203-x86_64.AppImage), I have 100% CPU eaten up by crashpad_handler, which is part of the appimage. Worse, the memory usage of crashpad_handler increases of about half a GB per second, until resident memory is exhausted and the swapper takes over. This is very bad.
- Fortunately, it seems that I can kill the crashpad_handler process with no incidence on Musescore: everything seems to be working (apart from crash reporting, I guess.)
- In the end, after killing crashpad_handler, Musescore 4.1.1 with an empty symphony orchestra score eats about 20-22% of my CPU while doing nothing.
- I tried the appimage named MuseScoreNightly-232350502-4.1.1-e4d1ddf-x86_64.AppImage, with a August 23 date. The issue with crashpad_handler seems to be gone, but the program still uses around 20-22% of CPU while idle on an empty Symphony Orchestra.
I still think than a program which is idle, minimized (nothing to draw on screen) and only waiting for the next mouse/keyboard event should use 0% CPU. I would not call "10%-15%" CPU great...
New test with OS: Ubuntu 22.04.2 LTS, Arch.: x86_64, MuseScore version (64-bit): 4.1.1-232071203, revision: github-musescore-musescore-e4d1ddf
RAM 16 Go, CPU i5 vPro, ThinkPad L450, xfce4 Symphonic score with 21 parts
With MuseSound During playback : CPU 12% Without playback : CPU 7% Thread for pulseaudio for both = 2%cpu No particular latency, behavior ok.
With MuseScore Basic During PLayback : CPU 11% Without playback : CPU 2,24% Thread for pulseaudio for both = 1,82%cpu No particular latency, behavior ok.
Thanks,
My test results on low-cost Windows laptop: ASUS VivoBook 14 X415JA
Intel Pentium 6805, RAM 8Gb, SSD1Tb, Ubuntu 22.04.3 LTS
Score with 36 Instr. (MS Basic)
MS3.6.2: During playback: CPU ~11 Without playback: CPU ~0,50
MS4.1.1/MS4.2 master: During playback: CPU ~16 Without playback: CPU ~3,50
Also, crashpad_handler from 4.1.1 takes on my machine 0% CPU
Thanks for the feedback; that's interesting.
I tried to pinpoint the high CPU problem on my computer and made an experiment: if I shutdown the sound system before running MuseScore with the command
systemctl --user stop pipewire pipewire.socket
Then my idle CPU usage of MuseScore 4 drops to 8~10%
So it seems the problem (or part of the problem) is related to the sound system. As sound must be handled in a very different way on linux and windows, this explains why windows users don't see the problem.
So it seems the problem (or part of the problem) is related to the sound system. As sound must be handled in a very different way on linux and windows, this explains why windows users don't see the problem.
This gives me idea. Try setting PipeWire sample/buffer rate manually or run MuseScore with custom PipeWire setting. Last time I used PipeWire, I noticed that Ardour and Reaper audio setting doesn't affect PipeWire, as I still have big latency with 256 buffer size. Maybe PipeWire decided to run MuseScore at a higher sample rate, which should increase CPU usage.
After #19740, CPU usage when idle is 2 times less than in the master (~1.6% and ~3.5% on European Concert Band template, MS Basic, LinuxUbuntu 22.04)
@RomanPudashkin, thanks a lot for your work, it does greatly improve Musescore idle performance on my computer.
I launch Musescore, ask for a New partition, orchestral-symphonic, minimize the window (so that the program is idle) and look at CPU usage
- With
MuseScore-4.1.1.232071203-x86_64.AppImage
, and the sound system enabled musescore uses about 20% cpu, and pipewire around 2% - With
MuseScore-4.1.1.232071203-x86_64.AppImage
, and the sound system disabled (withsystemctl --user stop pipewire pipewire.socket
) musescore uses about 9% cpu - With
MuseScoreNightly-233460305-master-50ae319-x86_64.AppImage
(downloaded 2023/12/12) and sound enabled musescore uses about 11% cpu and pipewire 4% - With
MuseScoreNightly-233460305-master-50ae319-x86_64.AppImage
and sound disabled musescore uses about 9% cpu (Musescore is the only user of sound, and pipewire usage goes to 0 as I quit Musescore.)
So, 4.2.0 will be a huge improvement, but, still, an Idle Musescore is burning cpu cycles somewhere, including with some interaction with the sound system...