bacpop / ska.rust

Split k-mer analysis – version 2
https://docs.rs/ska/latest/ska/
Apache License 2.0
56 stars 4 forks source link

Memory optimisation: don't store whole build array #19

Closed johnlees closed 1 year ago

johnlees commented 1 year ago

Simple change: combine build and merge steps so whole array of ska_dict are not stored in memory. On 28 Listeria (3228084, 38Mb skf file) before: 1 thread 11s, 2.3Gb 8 threads 5s, 3Gb

after: 1 thread 8s, 500Mb 2 threads (max) 6s, 890 Mb

Closes #17 (but more ideas there to further reduce memory if ever needed)

johnlees commented 1 year ago

TODO: fix the clippy lints

codecov[bot] commented 1 year ago

Codecov Report

Base: 82.02% // Head: 82.11% // Increases project coverage by +0.09% :tada:

Coverage data is based on head (203d780) compared to base (d777060). Patch coverage: 87.50% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #19 +/- ## ========================================== + Coverage 82.02% 82.11% +0.09% ========================================== Files 15 15 Lines 1513 1510 -3 Branches 264 265 +1 ========================================== - Hits 1241 1240 -1 + Misses 108 104 -4 - Partials 164 166 +2 ``` | [Impacted Files](https://codecov.io/gh/bacpop/ska.rust/pull/19?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bacpop) | Coverage Δ | | |---|---|---| | [src/ska\_dict/split\_kmer.rs](https://codecov.io/gh/bacpop/ska.rust/pull/19?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bacpop#diff-c3JjL3NrYV9kaWN0L3NwbGl0X2ttZXIucnM=) | `86.13% <ø> (-0.20%)` | :arrow_down: | | [src/ska\_ref.rs](https://codecov.io/gh/bacpop/ska.rust/pull/19?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bacpop#diff-c3JjL3NrYV9yZWYucnM=) | `85.62% <ø> (-0.18%)` | :arrow_down: | | [src/cli.rs](https://codecov.io/gh/bacpop/ska.rust/pull/19?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bacpop#diff-c3JjL2NsaS5ycw==) | `67.96% <57.14%> (-0.69%)` | :arrow_down: | | [src/lib.rs](https://codecov.io/gh/bacpop/ska.rust/pull/19?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bacpop#diff-c3JjL2xpYi5ycw==) | `72.88% <89.28%> (-0.24%)` | :arrow_down: | | [src/merge\_ska\_dict.rs](https://codecov.io/gh/bacpop/ska.rust/pull/19?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bacpop#diff-c3JjL21lcmdlX3NrYV9kaWN0LnJz) | `80.53% <90.00%> (+2.97%)` | :arrow_up: | | [src/io\_utils.rs](https://codecov.io/gh/bacpop/ska.rust/pull/19?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bacpop#diff-c3JjL2lvX3V0aWxzLnJz) | `84.90% <100.00%> (+0.29%)` | :arrow_up: | | [src/ska\_dict.rs](https://codecov.io/gh/bacpop/ska.rust/pull/19?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bacpop#diff-c3JjL3NrYV9kaWN0LnJz) | `86.15% <100.00%> (ø)` | | | [src/generic\_modes.rs](https://codecov.io/gh/bacpop/ska.rust/pull/19?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bacpop#diff-c3JjL2dlbmVyaWNfbW9kZXMucnM=) | `71.42% <0.00%> (-0.88%)` | :arrow_down: | | ... and [4 more](https://codecov.io/gh/bacpop/ska.rust/pull/19?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bacpop) | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bacpop). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bacpop)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.