Implement a safer_yield_per utility to avoid OOM issues and slowness.