65.9K
CodeProject is changing. Read more.
Home

Fast Expression Evaluation

starIconstarIconstarIconemptyStarIconemptyStarIcon

3.00/5 (1 vote)

Feb 22, 2010

CPOL
viewsIcon

15710

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"..