- Home /
Optimizations in scripts
I would like to know if Unity applies any optimization on C# scripts like loop unrolling, folding, common subexpression elimination, etc.
Answer by _Petroz · Jun 17, 2010 at 06:57 AM
I'm pretty sure Unity does not modify the C# code before passing it to the mono compiler. Mono does some simple optimizations during compilation.
There is some info here: http://www.mono-project.com/Mcs
The compiler performs a number of simple optimizations on its input: constant folding (this is required by the C# language spec) and can perform dead code elimination.
Loop unrolling only offers significant performance improvement for tight loops, which is something which should probably be written in native code.
-Pete
Your answer
Follow this Question
Related Questions
Spacial and temporal locality in Unity 0 Answers
Improving code performance 1 Answer
Is there some reference for things Unity excludes from an actual build? 2 Answers
EPIC Environments in Unity 4 0 Answers