Skip to content

Avoid deep-copying PackedGraph paths when the path vector grows - #250

Open
yeeus wants to merge 1 commit into
vgteam:masterfrom
yeeus:packedgraph-move-paths-on-growth
Open

yeeus wants to merge 1 commit into
vgteam:masterfrom
yeeus:packedgraph-move-paths-on-growth

Conversation

@yeeus

@yeeus yeeus commented Nov 24, 2026 •

Copy link
Copy Markdown

Growing the STL-backed PackedGraph path vector can deep-copy every existing path's packed step and link arrays. The underlying SDSL moves transfer ownership but lack noexcept, so std::vector::reserve chooses copies. Reserve a new outer vector first and explicitly move the existing path owners in order. Path IDs, step offsets and the mapped backends keep their existing behavior.

On a chr21 workload with 1,319 human haplotypes, adding this change to the existing optimized clip-vg stack gave the following paired results:

Command Peak RSS before Peak RSS after Wall time before Wall time after
Full preprocessing 418.30 GiB 219.80 GiB 13:04 9:40
Clip 419.42 GiB 223.08 GiB 2:00:35 1:56:22

Strict fingerprints of node IDs and sequences, edges, path metadata, and all ordered oriented steps matched for both outputs. The production benchmark used an earlier pinned libbdsg build. On that same base with a fixed jemalloc and synthetic graphs, peak RSS fell by 32.4% and 35.8%, respectively, with equal graph content.

On the current libbdsg base, the full test_libbdsg suite built and passed locally.

chr21 output verification

The follow-up r4 test changed the PackedGraph path-growth implementation used by clip-vg and reused the same cached inputs as r3. Both Full and Clip passed strict graph comparison against the r3 outputs. Node IDs and sequences, edges, path metadata, and ordered oriented steps all matched.

The parent r3 candidate had passed 37/37 final-output comparisons against its paired chr21 control and 37/37 against the original production outputs in scope. See ComparativeGenomicsToolkit/cactus#2096 for the workflow comparisons.

Scope of the chr21 benchmark

The frozen chr21 stack also used two earlier PackedGraph-specific changes: moving path steps to a fresh equivalent node on orientation changes, with the original rewrite used for circular paths, and compacting the path membership records in place. Both were already enabled in the r3 control of the r4 path-growth comparison. Neither has a standalone chr21 RSS measurement. The two-stage reduction reported in this PR isolates the path-growth fix.

Related upstream ports

The independent PackedGraph path-step transfer and in-place membership compaction are reviewed in #251 and #252.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant