While trying to speed up:
l = some_value
for i in range(1000):
for j in range(1000):
for k in range(1000):
function(i, j, k, l)
I stumbled upon multiprocessing.Pool().starmap()
however it requires the iterated values to be passed in as an interator [(0, 0, 0), (1, 0, 0), ...]
. Is there a fast way to get this list of tuples containing the for loop values?
Here's an iterator you need:
iterator = ((i, j, k, l) for i in range(1000)
for j in range(1000)
for k in range(1000))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.