Contents    Page-10    Prev    Next    Page+10    Index   

Constant Folding

Constant folding is performing operations on constants at compile time:


(/ (* angle 3.1415926) 180.0)

(sqrt 2.0)

The savings from doing this on programmer expressions is minor. However, there can be savings by optimizing the results of program manipulations.

Constant folding must be used with care: operators that have side effects should not be folded.


>(println "foo")
foo
nil
We do not want to replace this print with nil.