Skip to content

Commit 878f46d

Browse files
authored
Record start time before query processing starts (#21)
Also record end time immediately after obtaining results, before joining the processes. Also remove progress bar because all processes do not report intermediate progress and all processes finish in a similar time.
1 parent fd59cd8 commit 878f46d

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

engine/base_client/search.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -163,37 +163,32 @@ def worker_function(chunk, result_queue):
163163
# Create a queue to collect results
164164
result_queue = Queue()
165165

166-
# Create and start worker processes
166+
# Create worker processes
167167
processes = []
168168
for chunk in query_chunks:
169169
process = Process(target=worker_function, args=(chunk, result_queue))
170170
processes.append(process)
171-
process.start()
172171

173172
# Start measuring time for the critical work
174173
start = time.perf_counter()
175174

176-
# Create a progress bar for the total number of queries
177-
pbar = tqdm.tqdm(total=total_query_count, desc="Processing queries", unit="queries")
175+
# Start worker processes
176+
for process in processes:
177+
process.start()
178178

179179
# Collect results from all worker processes
180180
results = []
181181
for _ in processes:
182182
chunk_results = result_queue.get()
183183
results.extend(chunk_results)
184-
# Update the progress bar with the number of processed queries in this chunk
185-
pbar.update(len(chunk_results))
186184

187-
# Close the progress bar
188-
pbar.close()
185+
# Stop measuring time for the critical work
186+
total_time = time.perf_counter() - start
189187

190188
# Wait for all worker processes to finish
191189
for process in processes:
192190
process.join()
193191

194-
# Stop measuring time for the critical work
195-
total_time = time.perf_counter() - start
196-
197192
# Extract precisions and latencies (outside the timed section)
198193
precisions, latencies = zip(*results)
199194

0 commit comments

Comments
 (0)