






















你是否注意到,当你在高优先级下运行应用程序是,应用程序运行得特别快(这也视你运行什么样的应用程序而定)。拿WinRar做例子测试,你会发现解压缩要比正常优先级下快一些,但是也有一些应用程序性能要比正常优先级下性能差,所以在确定这样设置之前,先做测试,看是否能够比正常优先级下得到更高的性能。
如果你现在可以自由的更改应用程序的代码,你可以用下面代码做测试:
C#:
System.Diagnostics.Process myProcess = System.Diagnostics.Process.GetCurrentProcess();
myProcess.PriorityClass = System.Diagnostics.ProcessPriorityClass.High;
VB:
Dim myProcess As System.Diagnostics.Process = _
System.Diagnostics.Process.GetCurrentProcess()
myProcess.PriorityClass = System.Diagnostics.ProcessPriorityClass.High
你要做的就是在加载窗体前或任何你想改变进程优先级的地方使用此代码就可以了。
还有一种非常简单的解决方案:运行应用程序时使用/<priority>选项,选项列表如下:
要做到这一点,你所要做的就是使用start命令,语法如下:
start /{priority} {application}
例如:
start /high winword
start /low notepad
"C:\YourDirectory" start /realtime YourApplication.exe
or even from run command
cmd /c start /low calc
原文:CodeProject
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。