]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-34134: Advise to use imap or imap_unordered when handling long iterables. (gh...
authorWindson yang <wiwindson@outlook.com>
Fri, 25 Jan 2019 12:01:41 +0000 (20:01 +0800)
committerAntoine Pitrou <pitrou@free.fr>
Fri, 25 Jan 2019 12:01:41 +0000 (13:01 +0100)
Doc/library/multiprocessing.rst

index a77815918d2b0b7f58e6103ae2b9a556532b1189..987a0d508768cf2a2e4fb1763657a7a0251357ff 100644 (file)
@@ -2157,6 +2157,10 @@ with the :class:`Pool` class.
       the process pool as separate tasks.  The (approximate) size of these
       chunks can be specified by setting *chunksize* to a positive integer.
 
+      Note that it may cause high memory usage for very long iterables. Consider
+      using :meth:`imap` or :meth:`imap_unordered` with explicit *chunksize*
+      option for better efficiency.
+
    .. method:: map_async(func, iterable[, chunksize[, callback[, error_callback]]])
 
       A variant of the :meth:`.map` method which returns a result object.
@@ -2175,7 +2179,7 @@ with the :class:`Pool` class.
 
    .. method:: imap(func, iterable[, chunksize])
 
-      A lazier version of :meth:`map`.
+      A lazier version of :meth:`.map`.
 
       The *chunksize* argument is the same as the one used by the :meth:`.map`
       method.  For very long iterables using a large value for *chunksize* can