抱歉添加了死灵,但这对我来说也是一场持续的斗争,我想在图片中添加一些信息。VisualStudio 本身为时间添加了一个相当大的组件。这是基本测试,涉及一个基本的表单应用程序和一个在公司服务器内部托管的已经运行的 Web 服务(所有测试的 Generate Serialization Assembly 设置为 true):
Running in VS, Debug:
First Call: 400 ms to set up client object, 450 to call function
Second Call: 1 ms to set up client object, 14 to call function
Running as .exe, Release:
First Call: 20 ms to set up client object, 70 to call function
Second call: 1 ms to set up client object, 4 to call function
Running the Debug's .exe file outside of vs:
First Call: 20 ms to set up client object, 80 to call function
Second call: 1 ms to set up client object, 4 to call function
Running as Release within VS:
Similar results to Debug in VS -- very slow
短篇故事?Visual Studio 正在为图片添加大量时间。而不是约 90 毫秒,它需要将近一秒钟。因此,如果您正在进行性能调整,请确保在 VisualStudio 环境之外进行测试。