Posts tagged python,
Posts tagged python,
11 notes &
Thanks to @pims, I’ve changed the code from this morning to use generators instead of regular lists loaded in memory.
Here’s the output:
With lists:

With generators:

and the available RAM that I have on my machine right now :

I grabbed the snapshots right during run-time, and it takes the activity monitor about 2 seconds to update its info, which gave me enough time to capture the amount of memory used by the different scripts.
The source code for the generators is available here: https://gist.github.com/918579