自编译 Roslyn 构建性能:不如最初发布的 Roslyn 版本快 [英] Self-compiled Roslyn build performance: Not as fast as originally shipped Roslyn version

查看:67
本文介绍了自编译 Roslyn 构建性能:不如最初发布的 Roslyn 版本快的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Roslyn github 存储库Update-1>,构建csc.exe,然后用我自己构建的csc.exe版本编译一个随机的解决方案.

Checking out the branch Update-1 from the Roslyn github repository, building the csc.exe, and compiling a random Solution with the csc.exe version I just built myself.

我希望性能与 VS 2015 Update 1 附带的原始 Roslyn 版本相当,位于路径:C:\Program Files (x86)\MSBuild\14.0\Bin

I expect the performance to be comparable to the original Roslyn version which was shipped with VS 2015 Update 1, located in the path: C:\Program Files (x86)\MSBuild\14.0\Bin

与原始版本相比,我自己构建的 Roslyn 版本的构建性能明显更差.在我在测试中使用的解决方案中:大约 30 秒与 65 秒.

The build performance of the Roslyn version I built myself is significantly worse, compared to the original one. In the solution I used in my tests: roughly 30 seconds vs. 65 seconds.

  • 克隆 https://github.com/dotnet/roslyn.git 并签出分支更新-1
  • 使用 Release 配置构建 Roslyn(针对解决方案平台尝试了 Mixed Configurationx64.)
  • 为了编译测试解决方案,我更改了所有项目文件以使用 csc 路径的特定位置:

  • Cloned https://github.com/dotnet/roslyn.git and checked out branch update-1
  • Built Roslyn using Release configuration (tried with both, Mixed Configuration as well as x64 for the solution platform.)
  • To compile a test solution, I altered all project files to use a specific location for the csc path:

C:\Path\To\Output\Location\Of\Roslyn\Binaries\

出于测试目的,我正在使用

For testing purposes I am building the test solution from command line with

MSBuild.exe/t:Rebuild/m:1/verbosity:m MySolutionName.sln

我目前也在做清洁工作:

I am currently also doing a clean before:

MSBuild.exe/t:Clean/m:1/verbosity:m MySolutionName.sln

为了针对 VS 2015 Update 1 附带的原始编译器进行测试,我将项目文件中的配置更改为:

To test against the original compiler, shipped with VS 2015 Update 1, I am changing the configuration in the project files to:

C:\Program Files (x86)\MSBuild\14.0\Bin\

  • 如何使用我的自编译 Roslyn 版本(如最初提供的 Roslyn dll)来实现类似的性能?
  • 在构建 Roslyn 本身时,是否还有其他需要考虑的事情(例如优化等)?

推荐答案

最大的区别是 Visual Studio 在 NGEN 中安装的官方编译器作为安装的一部分进行编译.

The biggest difference is that the official compiler installed by Visual Studio in NGEN compiled as part of the install.

但是,即使您使用 NGEN,您也不会得到完全相同的结果,因为 Microsoft 具有配置文件引导的训练数据来支持部分 NGEN,以便在不属于 NGEN 的二进制大小和 JIT 时间之间取得良好的平衡公共存储库(类似于使用 Microsoft 官方私钥签名).

However, even if you NGEN, you won't get exactly equivalent results, because Microsoft has profile guided training data to support partial NGEN, in order to get a good balance between binary size and JIT time that isn't part of the public repo (similar to signing with the official Microsoft private key).

这篇关于自编译 Roslyn 构建性能:不如最初发布的 Roslyn 版本快的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆