perf tune, use a generator