Adding a sleep to the generate script's infinite loop which seems to fix up performance of the script nicely. Probably best not to super busy wait on the main thread when it isn't doing anything.