Skip to content

Commit

Permalink
Memory optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
schutzekatze committed Jan 25, 2021
1 parent c099f52 commit 1b5ae82
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions RResolver/RAlgorithmsShort.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class Support
{
public:

enum class UnknownReason : unsigned {
enum class UnknownReason : uint8_t {
UNDETERMINED = 0, // Not yet processed
TOO_MANY_COMBINATIONS, // Branching out exploded beyond a threshold
OVER_MAX_TESTS, // Planned tests was above the threshold
Expand All @@ -102,13 +102,15 @@ class Support
Support(int calculatedTests, UnknownReason unknownReason)
: found(-1)
, tests(-1)
, calculatedTests(calculatedTests)
, unknownReason(unknownReason)
{
assert(calculatedTests >= 0);
if (calculatedTests > std::numeric_limits<decltype(this->calculatedTests)>::max()) { this->calculatedTests = std::numeric_limits<decltype(this->calculatedTests)>::max(); } else {
this->calculatedTests = calculatedTests;
}
}

Support(int found, int tests)
Support(int8_t found, int8_t tests)
: found(found)
, tests(tests)
{
Expand All @@ -117,14 +119,16 @@ class Support
assert(calculatedTests == -1);
}

Support(int found, int tests, int calculatedTests)
Support(int8_t found, int8_t tests, int calculatedTests)
: found(found)
, tests(tests)
, calculatedTests(calculatedTests)
{
assert(found >= 0);
assert(tests > 0);
assert(calculatedTests >= 0);
if (calculatedTests > std::numeric_limits<decltype(this->calculatedTests)>::max()) { this->calculatedTests = std::numeric_limits<decltype(this->calculatedTests)>::max(); } else {
this->calculatedTests = calculatedTests;
}
}

bool unknown() const { return tests == -1; }
Expand All @@ -141,9 +145,9 @@ class Support

bool operator<(const Support& s) { return found < s.found; }

int found = -1;
int tests = -1;
int calculatedTests = -1;
int8_t found = -1;
int8_t tests = -1;
int8_t calculatedTests = -1;
UnknownReason unknownReason = UnknownReason::UNDETERMINED;
};

Expand Down
2 changes: 1 addition & 1 deletion RResolver/RResolverShort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static const char USAGE_MESSAGE[] =
" Histograms are omitted if no prefix is given."
" -t, --threshold=N set path support threshold to N. [4]"
" -x, --extract=N extract N rmers per read. [4]"
" -m, --min-tests=N set minimum number of sliding window moves to N. [20]"
" -m, --min-tests=N set minimum number of sliding window moves to N. Maximum value is 127. [20]"
" -n, --branching=N set maximum number of branching paths to N. [75]"
" -r, --rmer=N explicitly set r value (k value used by rresolver)."
" The number of set r values should be equalto the number of read sizes."
Expand Down

0 comments on commit 1b5ae82

Please sign in to comment.