Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3bab40d

Browse files
Windsooonpitrou
authored andcommitted
bpo-34134: Advise to use imap or imap_unordered when handling long iterables. (gh-8324)
1 parent 62c35a8 commit 3bab40d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Doc/library/multiprocessing.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2157,6 +2157,10 @@ with the :class:`Pool` class.
21572157
the process pool as separate tasks. The (approximate) size of these
21582158
chunks can be specified by setting *chunksize* to a positive integer.
21592159

2160+
Note that it may cause high memory usage for very long iterables. Consider
2161+
using :meth:`imap` or :meth:`imap_unordered` with explicit *chunksize*
2162+
option for better efficiency.
2163+
21602164
.. method:: map_async(func, iterable[, chunksize[, callback[, error_callback]]])
21612165

21622166
A variant of the :meth:`.map` method which returns a result object.
@@ -2175,7 +2179,7 @@ with the :class:`Pool` class.
21752179

21762180
.. method:: imap(func, iterable[, chunksize])
21772181

2178-
A lazier version of :meth:`map`.
2182+
A lazier version of :meth:`.map`.
21792183

21802184
The *chunksize* argument is the same as the one used by the :meth:`.map`
21812185
method. For very long iterables using a large value for *chunksize* can

0 commit comments

Comments
 (0)