From 34b9e54c0f221686a659391fd630ca4083d0cd05 Mon Sep 17 00:00:00 2001 From: starnakin Date: Tue, 5 Dec 2023 11:05:57 +0100 Subject: [PATCH] multi thread but slow --- 2023/day05/src/part2.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/2023/day05/src/part2.py b/2023/day05/src/part2.py index 1ef3549..73884b5 100644 --- a/2023/day05/src/part2.py +++ b/2023/day05/src/part2.py @@ -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) \ No newline at end of file