multi thread but slow
This commit is contained in:
parent
bf896841d2
commit
34b9e54c0f
@ -69,8 +69,9 @@ def thread_process(convertions, start_value, chunk):
|
|||||||
global values
|
global values
|
||||||
values.append(get_min_in_range(convertions, start_value, chunk))
|
values.append(get_min_in_range(convertions, start_value, chunk))
|
||||||
|
|
||||||
CHUNK_SIZE = 10
|
CHUNK_SIZE = 10000000
|
||||||
for current_range in current_ranges:
|
for current_range in current_ranges:
|
||||||
|
print("new range")
|
||||||
start, stop = current_range
|
start, stop = current_range
|
||||||
i = start
|
i = start
|
||||||
chunks = []
|
chunks = []
|
||||||
@ -85,11 +86,13 @@ for current_range in current_ranges:
|
|||||||
while (i < len(chunks)):
|
while (i < len(chunks)):
|
||||||
t = threading.Thread(target=thread_process, args=(convertions, start_value, chunks[i]))
|
t = threading.Thread(target=thread_process, args=(convertions, start_value, chunks[i]))
|
||||||
t.start()
|
t.start()
|
||||||
display_duration(1, len(chunks))
|
print(f"start thread{i}/{len(chunks) - 1}")
|
||||||
print(i, '/', len(chunks))
|
|
||||||
i += 1
|
i += 1
|
||||||
start_value = chunks[i - 1]
|
start_value = chunks[i - 1]
|
||||||
|
|
||||||
|
while (True):
|
||||||
|
print(len(values))
|
||||||
|
|
||||||
_value = min(values)
|
_value = min(values)
|
||||||
|
|
||||||
print(_value)
|
print(_value)
|
Loading…
Reference in New Issue
Block a user