From 5152802c6bedfa08f0bc0ef4e5dda87274bf7456 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Thu, 29 Jan 2026 23:07:34 +0000 Subject: [PATCH] remove poor algorithm --- parsers/survex.py | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/parsers/survex.py b/parsers/survex.py index cec97ac..2e5c599 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -540,44 +540,6 @@ class LoadingSurvex: return topo_sorted_list - def get_generational_chunks(sorted_blocks): - """ - Splits a topologically sorted list into chunks where no child - exists in the same chunk as its parent. - """ - chunks = [] - # Track which IDs are already "saved" (in a previous chunk) - saved_ids = set() - - # current_batch will hold blocks for the current "generation" - current_batch = [] - - for block in sorted_blocks: - parent_id = getattr(block.parent, '_blockid', block.parent) - - # If the parent is not yet 'saved', this block MUST - # go into a future batch. - if parent_id and parent_id not in saved_ids: - # Finish the current chunk and start a new one - if current_batch: - chunks.append(current_batch) - # Mark everything in the finished batch as 'saved' - saved_ids.update(b._blockid for b in current_batch) - current_batch = [] - - current_batch.append(block) - - # Safety: Even if there are no dependencies, respect the BATCH_SIZE - if len(current_batch) >= BATCH_SIZE: - chunks.append(current_batch) - saved_ids.update(b._blockid for b in current_batch) - current_batch = [] - - # Add the final trailing batch - if current_batch: - chunks.append(current_batch) - - return chunks def get_generational_chunks_optimized(blocks): """ Splits a topologically sorted list into chunks where no child