Fix generator size calculation.
Add optimization levels.