diff options
author | Windson yang <wiwindson@outlook.com> | 2019-01-25 12:01:41 (GMT) |
---|---|---|
committer | Antoine Pitrou <pitrou@free.fr> | 2019-01-25 12:01:41 (GMT) |
commit | 3bab40db96efda2e127ef84e6501fda0cdc4f5b8 (patch) | |
tree | b748b8710c7ca5923fd540b7c2a66fb85dd47908 /Doc/library/multiprocessing.rst | |
parent | 62c35a8a8ff5854ed470b1c16a7a14f3bb80368c (diff) | |
download | cpython-3bab40db96efda2e127ef84e6501fda0cdc4f5b8.zip cpython-3bab40db96efda2e127ef84e6501fda0cdc4f5b8.tar.gz cpython-3bab40db96efda2e127ef84e6501fda0cdc4f5b8.tar.bz2 |
bpo-34134: Advise to use imap or imap_unordered when handling long iterables. (gh-8324)
Diffstat (limited to 'Doc/library/multiprocessing.rst')
-rw-r--r-- | Doc/library/multiprocessing.rst | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index a778159..987a0d5 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -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 |