I've wrote a simple .net WPF
application(contains only 2 small windows), but its launch is too slow - about 10-20 seconds!
我编写了一个简单的。net WPF应用程序(只包含两个小窗口),但是它的启动太慢了——大约10-20秒!
Profiler says:
分析器说:
-
Main->RunInternal
(56%) - 主要- > RunInternal(56%)
-
Main->RunInternal->ctor->LoadBaml
(32%) - 主要- > RunInternal - >男星- > LoadBaml(32%)
Biggest part of application load time - is body of Main->RunInternal
function, this isn't my function and i don't know what they makes. Can their execution time somehow be optimized?
应用程序加载时间的最大部分是Main->RunInternal函数,这不是我的函数,我不知道它们是什么。它们的执行时间能以某种方式优化吗?
Loading Baml markup it takes 32% of all time, but my program have only 3 XAML files and they are containing less than 100 lines of code. Why does this action take so long?
加载Baml标记需要32%的时间,但是我的程序只有3个XAML文件,它们包含的代码少于100行。为什么这个行动需要这么长时间?
Before asking I have read and tried these tricks, but they didn't help me:
在问我之前,我读过并尝试过这些技巧,但它们并没有帮助我:
- WPF application slow on startup
- WPF应用程序启动缓慢。
- http://msdn.microsoft.com/en-us/library/cc656914.aspx
- http://msdn.microsoft.com/en-us/library/cc656914.aspx
So, how can I speed up the start time of my application?
那么,如何加快应用程序的启动时间呢?
Thanks.
谢谢。
PS. I've tested this program on two similar computers and the result is a same.
我在两台类似的电脑上测试过这个程序,结果是一样的。
2 个解决方案
#1
3
Look at the article mentioned in the comments above.
看看上面评论中提到的文章。
I would suppose it is 8, (Authenticode), it depends on what assemblies you are referencing
我假设它是8 (Authenticode),它取决于您正在引用的程序集
#2
0
I have the same problem. Google with RunInternal gives me nothing.
我也有同样的问题。有RunInternal的谷歌不会给我任何东西。
I then tried to backup my previous codes and delete assemblies and files until there was only a window left.
然后,我尝试备份以前的代码,删除程序集和文件,直到只剩下一个窗口。
Then it worked -- the startup time was shortened from 10 sec to 1 sec!This time, the profiler showed only System.Windows.Application.Run() instead of RunInternal
这次,分析器只显示System.Windows.Application.Run()而不是RunInternal
It's very strange that for this computer, even after re-importing the bugged(slow) version, it worked correctly! whereas my laptop, which did not go through the fixing above still boots the program for 10+ sec.
很奇怪,对于这台计算机来说,即使重新输入了bug(缓慢)版本,它也能正常工作!而我的笔记本电脑,没有经过上述的修复,仍然引导程序超过10秒。
#1
3
Look at the article mentioned in the comments above.
看看上面评论中提到的文章。
I would suppose it is 8, (Authenticode), it depends on what assemblies you are referencing
我假设它是8 (Authenticode),它取决于您正在引用的程序集
#2
0
I have the same problem. Google with RunInternal gives me nothing.
我也有同样的问题。有RunInternal的谷歌不会给我任何东西。
I then tried to backup my previous codes and delete assemblies and files until there was only a window left.
然后,我尝试备份以前的代码,删除程序集和文件,直到只剩下一个窗口。
Then it worked -- the startup time was shortened from 10 sec to 1 sec!This time, the profiler showed only System.Windows.Application.Run() instead of RunInternal
这次,分析器只显示System.Windows.Application.Run()而不是RunInternal
It's very strange that for this computer, even after re-importing the bugged(slow) version, it worked correctly! whereas my laptop, which did not go through the fixing above still boots the program for 10+ sec.
很奇怪,对于这台计算机来说,即使重新输入了bug(缓慢)版本,它也能正常工作!而我的笔记本电脑,没有经过上述的修复,仍然引导程序超过10秒。