Reduce the number of invocations of the generator during compile