optimize CodeGenerator