multi thread but slow

This commit is contained in:
starnakin 2023-12-05 11:05:57 +01:00
parent bf896841d2
commit 34b9e54c0f

View File

@ -69,8 +69,9 @@ def thread_process(convertions, start_value, chunk):
global values
values.append(get_min_in_range(convertions, start_value, chunk))
CHUNK_SIZE = 10
CHUNK_SIZE = 10000000
for current_range in current_ranges:
print("new range")
start, stop = current_range
i = start
chunks = []
@ -85,11 +86,13 @@ for current_range in current_ranges:
while (i < len(chunks)):
t = threading.Thread(target=thread_process, args=(convertions, start_value, chunks[i]))
t.start()
display_duration(1, len(chunks))
print(i, '/', len(chunks))
print(f"start thread{i}/{len(chunks) - 1}")
i += 1
start_value = chunks[i - 1]
while (True):
print(len(values))
_value = min(values)
print(_value)