Difference between revisions of "Talk:Garbage Reduction"

From Kerbal Space Program Wiki
Jump to: navigation, search
(Validity of this advice)
 
Line 3: Line 3:
  
 
== Validity of this advice ==
 
== Validity of this advice ==
As an experienced .NET developer with a lot of knowledge of the underlying design and code of linq and the compiler/execution machinery, I believe almost all of this advice to be situational at best and flat out untrue at worst. Similar to above "VisualStudio vs MonoDevelop vs Unity Compiler", I do not believe there is any evidence to backup anything about foreach, linq, or singletons. The final piece of advice about not iterating through large datastructures every frame is good performance advice but has nothing to do with GC. If SQUAD got better performance by removing linq, foreach, and singletons, I am confident it is from rewriting the code rather than the simple removal of using those features. The worst advice on this page is to avoid declaring variables. Every object participating in your .net functions will be represented equally in the intermediate language these projects compile to. Not declaring them a variable in your code just makes your code harder to read and debug. To debunk one specific piece of advice on avoiding foreach - https://msdn.microsoft.com/en-us/magazine/mt797654.aspx foreach loops are compiled to their equivalent, traditional, high-performing control flow structure in IL. There is NO reason to avoid using them because you will get the same outcome.
+
Added a precautionary note at the top with a link to a more authoritative source.

Latest revision as of 20:20, 13 June 2018

VisualStudio vs MonoDevelop vs Unity Compiler

The article states that foreach should be avoided with MonoDevelop. Is there any evidence that this is actually the case? This problem was documented with the Unity compiler, but that's not the same as the mono compiler.

Validity of this advice

Added a precautionary note at the top with a link to a more authoritative source.