DIVEX

The Optimize operator

The Optimize allows you to optimize a function:

DelFunc.DF1 add = (int a, int b) => a + b;

var addTwo = add
    .Rename(a_x: 0)
    .Rename(b_y: 0)
    .Apply(x: 2);

var addTwoOptimized = addTwo.Optimize();

var twoPlusThree = addTwoOptimized.Invoke(y: 3);
DelFunc.DF1 is a Delegate Function. Delegate Functions is a way to support treating lambdas as functions.

In the code above, the Optimize operator is used to optimize the addTwo function. The Optimize operator has no effect on the behavior of the function whatsoever. It only optimizes the generated code to reduce the number of method calls the generated code contains.