Optimizations in scripts

I would like to know if Unity applies any optimization on C# scripts like loop unrolling, folding, common subexpression elimination, etc.

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