use chunk to prepare multhread
This commit is contained in:
parent
618324bb17
commit
4d2161f5b1
@ -63,16 +63,30 @@ def get_min_in_range(lst_conversions, start, stop):
|
|||||||
print(i - start, '/', stop - start)
|
print(i - start, '/', stop - start)
|
||||||
|
|
||||||
value = do_all_convertions(lst_conversions, i)
|
value = do_all_convertions(lst_conversions, i)
|
||||||
print(min_value, value, min(value, min_value))
|
#print(min_value, value, min(value, min_value))
|
||||||
min_value = min(value, min_value)
|
min_value = min(value, min_value)
|
||||||
i += 1
|
i += 1
|
||||||
return (min_value)
|
return (min_value)
|
||||||
|
|
||||||
_min = 2000000000000000000
|
CHUNK_SIZE = 10
|
||||||
|
values = []
|
||||||
for current_range in current_ranges:
|
for current_range in current_ranges:
|
||||||
start, stop = current_range
|
start, stop = current_range
|
||||||
_min = min(_min, get_min_in_range(convertions, start, stop))
|
i = start
|
||||||
|
chunks = []
|
||||||
|
while(i < stop):
|
||||||
|
i += CHUNK_SIZE
|
||||||
|
if (i >= stop):
|
||||||
|
chunks.append(stop)
|
||||||
|
else:
|
||||||
|
chunks.append(i)
|
||||||
|
start_value = start
|
||||||
|
i = 0
|
||||||
|
while (i < len(chunks)):
|
||||||
|
values.append(get_min_in_range(convertions, start_value, chunks[i]))
|
||||||
|
i += 1
|
||||||
|
start_value = chunks[i - 1]
|
||||||
|
|
||||||
_value = _min
|
_value = min(values)
|
||||||
|
|
||||||
print(_value)
|
print(_value)
|
Loading…
Reference in New Issue
Block a user