Vanguard Software
Forecasting & Planning Solutions

contents.gifindex.gifprev1.gifnext1.gif

Invariant Code Optimization

Invariant code optimization is best illustrated by example. Assume you have the following code:

var total;
for(var n=0; n<1000; n++)
total+=1+2+3+4;

The expression 1+2+3+4; will normally be executed 1000 times. However, each time this expression is evaluated, it returns the same result. Therefore, you can rewrite the code as follows:

var total;
for(var n=0; n<1000; n++)
total+=10;

DScript will perform this optimization automatically at runtime. Any attempts you make to optimize your code in this way will probably not result in any performance increase.

  Forecasting Software  |  Strategic Planning Software  |  Decision Support Software
Decision Tree Software  |  Monte Carlo Simulation Software  |  Risk Analysis Software
Portfolio Analysis Software  |  Expert System Software  |  Online Forms

Contact Us  |  Terms of Use  |  Privacy Policy  |  Site Map
Vanguard Software
© 2009 Vanguard Software Corporation
Home Products Solutions Services Customers Partners Company
Vanguard
Applying science to business management
Vanguard
Print this page   Email this page to a friend