mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
bpo-34134: Advise to use imap or imap_unordered when handling long iterables. (gh-8324)
This commit is contained in:
parent
62c35a8a8f
commit
3bab40db96
1 changed files with 5 additions and 1 deletions
|
|
@ -2157,6 +2157,10 @@ with the :class:`Pool` class.
|
||||||
the process pool as separate tasks. The (approximate) size of these
|
the process pool as separate tasks. The (approximate) size of these
|
||||||
chunks can be specified by setting *chunksize* to a positive integer.
|
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]]])
|
.. method:: map_async(func, iterable[, chunksize[, callback[, error_callback]]])
|
||||||
|
|
||||||
A variant of the :meth:`.map` method which returns a result object.
|
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])
|
.. 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`
|
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
|
method. For very long iterables using a large value for *chunksize* can
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue