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.
Also, warnings are output, and sometimes, the IDE or the terminal reading the compiler output may be slowed down if you have a lot of warnings.
Warnings must not be ignored. You'd better fix every possible error before starting software testing. You may waste much time and effort to find an error in the debugger, although the compiler gives you an explicit warning about it.
The short answer: Use "-w" to ignore warnings.
Not only does handling the warnings make better code, it makes you a better programmer. Warnings will tell you about things that may seem little to you today, but one day that bad habit will come back and bite your head off. Use the correct type, return that value, evaluate that return value.
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.
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.
Update: Experimental results.
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.
Compilation speed on a Core i7 920, 9 GB RAM, single 7.2 krpm disk:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With