Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

Fast Expression Evaluation

3.00/5 (1 vote)
25 Feb 2010CPOL 1  
Use Expression += Value instead of Expression = Expression + Value. Since Expression can be arbitrarily complex, this can result in lots of unnecessary work. This forces the JIT to evaluate both copies of Expression, and many times this is not needed. The first statement can be optimized far...
Use Expression += Value instead of Expression = Expression + Value.
Since Expression can be arbitrarily complex, this can result in lots of unnecessary work. This forces the JIT to evaluate both copies of Expression, and many times this is not needed. The first statement can be optimized far better than the second, since the JIT can avoid evaluating the Expression twice.

N.B: Expression it self is a Variable not "Expression"..

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)