#PHP generators can process 1M records without keeping in memory 👌🔥
interesting part that the dataset hasn’t become smaller.. You’ve simply changed when you consume it.
Sometimes performance is about timing!
Replace building array with yield ⚠️
Your function produces one record at a time instead of keeping the entire dataset in memory.
In #Laravel even switching from all() to lazy() can make a huge difference 🐘
commit 6c8b4c4