Optimization of periodic single-photon sources