Comments weigh the code in C #?

4

I use the C # language with the Unity Engine, and as many programmers have access to the code, we often talk a lot so that everyone can understand what's in it. I saw in other answers recommendations for using a minifier but they were always related to languages for web development. Would this be useful / applies to C # in this case? How can I optimize this part?

    
asked by anonymous 04.05.2018 / 16:53

4 answers

2

As C# is usually used compiled , the compiler itself leaves the comments aside, meaning they do not interfere with the size or performance of your program.

Definitely comments are not something you'll need to worry about in this language, but there are a number of other ways to optimize your C# sheet. In this link has some tips that are worth checking out.

    
23.07.2018 / 20:05
6

You've seen this , right? Although there say that it makes practically no difference, the context is not web but interpreted languages.

Minimization is required for code transmission. The gain is too small for the build that occurs on the client. The only reason to minify is that the source travels over the network. With WebAssembly this problem ends because the code is compiled before.

C # is compiled , so they even weigh to make a parsing , because it is more text to evaluate, but it's something tame, despicable, does not even tickle in the compiler. For the execution the comment has zero weight by all the forms that analyze since they disappear completely.

C # has other things going for execution that weigh and people do not realize it:)

    
04.05.2018 / 16:58
5

Comments are ignored by compilers / transpilators during lexical analysis by when code is compiled comments are always passed in front of, not even being in binary executable files.

The reason we use the minification in web development is that the client downloads the file .css , .js , etc and then it reads the file locally. All comments, blanks, and blank lines are ignored however the client has already downloaded the file with them, wasting bandwidth and space.

The minification then serves to make sure that the files in the web development only follow what is really needed for the page and in some cases even change the names of the variables to use fewer characters.

Useful resources:

04.05.2018 / 16:59
2

Because C # is compiled, comments are ignored by the compiler, meaning there is no loss of performance. Take a look at the logic of your system, maybe the way it was written is weighing.

    
04.05.2018 / 17:00