难道一个大量的警告,使C#编译时间更长? [英] Does a huge amount of warnings make C# compile time longer?

查看:181
本文介绍了难道一个大量的警告,使C#编译时间更长?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有数以千计的警告一大解决方案。难道需要较少的编译解决方案,如果我删除了所有的警告(手动或使用工具)?

We have a big solution with thousands of warnings. Would it take less to compile the solution if I removed all of the warnings (either manually or using a tool)?

我试着降低详细级别,以无声的,没有用的。最大冗余级别都没有区别无论是。

I've tried lowering the verbosity level to silent, no use. Maximum verbosity level makes no difference either.

推荐答案

没有,也不会做出编译时间显著的影响。不同于像FX警察专用工具,编译器本身并没有就执行任何复杂的检查,所以它必须履行它的无足轻重的其他逻辑。

No, it wouldn't make a significant impact on compilation time. Unlike special tools like FX Cop the compiler itself doesn't perform any complicated checks so in respect to the other logic it has to perform it's insignificant.

究竟可能会降低性能有位输出非常大量的信息到控制台窗口的命令行编译时。在这种情况下,输出重定向到一个文件是一个可能的改进。

What actually may decrease the performance a bit is outputting a very large amount of messages into the console window when compiling from the command line. In this case redirecting the output into a file is a possible improvement.

然而,这是固定的code产生警告那些部分是一个好主意。你会最终获得一个更高质量的code群和缓解,否则更容易发生一些错误。

However, it's a good idea to fix those parts of code that generate warnings. You'll end up with a higher quality code base and mitigate some bugs that would otherwise occur more easily.

更新:实验

我们的codeBase的具有约。 34万行C#code分为48个项目在一个单一的解决方案。重新编译产生460警告。编译器的输出为2800线多头,当重定向到一个文件中占地近400 KB。

Our codebase has approx. 340 thousand lines of C# code divided into 48 projects in a single solution. Recompiling yields 460 warnings. The compiler's output is 2800 lines longs and occupies nearly 400 kB when redirected into a file.

在酷睿i7 920,9 GB RAM编译速度,单7.2 KRPM盘:

Compilation speed on a Core i7 920, 9 GB RAM, single 7.2 krpm disk:

    输出到一个控制台窗口时,
  • 47秒,
  • 43秒时重定向到一个文件 - 这就是9.1%的跌幅在编译时间
  • 47 seconds when outputting into a console window,
  • 43 seconds when redirecting into a file — that is 9.1% decrease in compilation time.

现在的时间是从三个汇编均线,有一些初始编译强制文件到缓存中。请注意,我没有做任何测量,警告关闭。

All times are averages from three compilations, with a few initial compiles to force the files into the cache. Note that I didn't do any measurements with warnings turned off.

这篇关于难道一个大量的警告,使C#编译时间更长?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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