Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace HashMaps with a bit-vector for unique depth computation #201

Merged
merged 5 commits into from
Dec 29, 2024

Conversation

sampsyo
Copy link
Collaborator

@sampsyo sampsyo commented Dec 29, 2024

Just a low-hanging fruit optimization for this op: instead of a Vec<HashMap<usize>>, we can use a single BitVec.

I did this in three steps and measured their performance on the chr22 GFA:

  • Switching to a dense vector, but not a proper bit vector: 14.7 -> 2.2 seconds
  • Switching to a proper bit vector from the bit-vec crate: 2.2 -> 2.0 seconds
  • Reusing a single bit vector instead of allocating in the loop: no effect; maybe the optimizer already got this

Anyway, a quick profiling run suggests that running fgfa depth > /dev/null on this graph is now 90% printing stuff and 10% actual depth computation, so I think we'll call that good.

On chr22 (already converted to FlatGFA), this seems like a pretty big
performance win: depth goes from 14.7 to 2.2 seconds.
Further speeds up chr22 depth computation, from 2.2 to 2.0 seconds.
Seems to have no impact on performance, but it makes me feel better
anyway.
@sampsyo sampsyo merged commit 0d5d820 into main Dec 29, 2024
3 of 4 checks passed
@sampsyo sampsyo deleted the fgfa-depth-overhaul branch December 29, 2024 20:38
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