News for hackers. Stuff that matters.
Re:Why Would Anyone Need JavaScript Generator Functions? by Izkata on Monday November 07, 2022 @12:38PM (#33509165)
There's two places I've used them in the past year where it was a natural fit:

* Querying solr for a massive amount of data using cursors, where the api and cursor use is hidden so I only have to process the result as a simple loop.

* Pulling csv data from disk and grouping by one of the columns, so the main loop is simply looping over groups without having to do that logic itself.

One of they key points in both versions is that the data can be too big to pre-process, and the system would run out of memory if I tried to load it all in at once.

There are no comments on this comment yet.