You may have noticed that your system performance has recently taken a hit. When you visit the task manager to go to the root of the problem, you may see that the main culprit is mscorsvw.exe. Here I will tell you all about the .NET Runtime Optimization service and how you can speed it up using 2 simple methods.
What Is The .NET Runtime Optimization Service?
While many users do not notice this process running in the background at all. It is actually a component of Windows that optimizes your system to launch apps faster.
The .NET Framework is a popular choice among software developers to write and develop apps. it is so because the .NET framework contains a technology called the Native Image Generator (NGEN) that makes launching apps faster. It will also periodically optimize your machine.
How To Fix .NET Runtime Optimization Service High CPU Usage
It is ironic that an optimization service hogs up CPU resources. It slows down because it needs to recompile its libraries for optimizing the launching of applications on your system.
First and foremost, you should not try to end this task from the task manager. You should know that it is performing an important task in the background of helping your apps launch run faster. The slowing down of your system only temporary as it will return to normal after this task is finished.
However, there is something you can do to speed up the optimization service. These fixes will speed up the .NET Runtime Optimization service and help it finish its tasks faster.
# FIX 1 (Enable Multi-Core Usage)
By default, the .NET Runtime Optimization service uses only one CPU core. So, the multi-core CPU that you have is not being utilized to its full potential.
You can tell the service to utilize more than one core (Up to 6 cores) that will speed up the task it is running, and you can perform other tasks faster.
Note: Majority of the speed up occurs for the .NET Framework 4. If you only have the .NET Framework 2 or 3.5 installed, the speedup effect will be more minor.
- Open an elevated Command Prompt. To do so, open the Run dialogue by pressing Win + R, type cmd and press Ctrl + Shift + Enter to launch the command prompt with administrative privileges.
- If you have your Windows installed in the C drive, use the following commands and press Enter:
For 32-bit OS: cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
For 64-bit OS: cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319
3. Type the following command next and press Enter:
ngen.exe executequeueditems
4. Check if the CPU usage has gone back to normal from the Task Manager.
These commands instruct the .NET Runtime Optimization service to use all the available cores (up to 6 cores) of the CPU to finish the task quicker.
However, if you are uncomfortable running the command prompt, you can follow this next method as well.
# FIX 2 (Run The Official Script By Microsoft)
If you don’t like running the command yourself or if you have an older version of Windows, you can use the official script made by Microsoft made by them for the same thing.
1. Visit the GitHub page of the script here.
2. Right-click on the Raw button and click on Save link as.
3. Make sure that the file type is Windows Script Host file.
4. Download the file.
5. Double click and execute the file to run the script.
This will execute the multicore usage and tells the NET Runtime Optimization service to finish its task fast.
When You Can See This Service Running?
This service runs at mainly two times.
- When the .NET Framework is installed on your machine
- When the .NET Framework is serviced by Windows Update
According to the Microsoft developers, here is an excerpt:
“We try to update and optimize the .NET Framework during the night (specific to each time zone), while most people are sleeping. Sometimes, it isn’t possible to do that, particularly if a machine is turned off. As a result, the .NET Framework is sometimes updated during the day, which then requires the .NET Framework Optimization Service to run during the day, too.
When that happens, you might notice the service running and possibly slowing down your machine for a period of time.”
Conclusion
Many app developers have used the NET Runtime Framework to make the app launches faster. But the high CPU usage is sometimes annoying. Now you know how to re-solve the .NET Runtime Optimization service high CPU Usage using the two fixes given above. Comment below if you successfully solved this issue and discuss further the same.
Method 1 worked for me! Thanks for posting this, now my PC with low CPU usage can now be usable!
Glad the solutions helped!
Had to use method 2 as #1 was refused by the system, usage went down quickly
Hope method 2 solved the issue. the commands in method 1 may not work on all computers.
I thought I’d screwed up with the first method as it took so long to run the command, but it finally got to the end and now it isn’t hogging the CPU. Thanks
# FIX 1 worked for me, CPU usage is back to normal. The command ran for about 15 minutes.
Thanks for sharing.
Saving the file, DrainNGenQueue.wsf, whether to Desktop or to a C: /folder makes it DrainNGenQueue.wsf.txt,
which is *.txt” not *.wsf”
which makes steps 3-5 confusing:
3. Make sure that the file type is Windows Script Host file.
4. Download the file.
5. Double click and execute the file to run the script.
so I didn’t do anything with the file.
What should I do to apply the fix?
Thanks for the thoughts, but I would offer a recommendation to some folks who find this. Don’t miss Anubhab’s paragraph jus tbefore “Fix #1”. He notes that: “First and foremost…The slowing down of your system only temporary as it will return to normal after this task is finished.”
I press this point because I found my machine’s fan suddenly noisy, and Task Manager showed this process as the highest user of CPU,. And in the time it took for me to do some searching and find this post, by the time I got to reviewing the comments (to see if anyone hit any snags with the offered “fix” options), I found that the fan spun down and the process was gone. It was indeed temporary.
I might even propose that this paragraph be labelled with a heading of “Fix #0”, lest people miss it. So many folks find posts and start running tweaks…and sometimes a tweak that worked some years ago may not work still or as well now.
Better to learn that it is something that can be expected to pass, if one is patient. 🙂 Anyway, that’s what happened to me, and I wanted to share this if it may help others.
But again, Thanks, Anubhab, for the post and the suggestions, for those who may find they do need them.