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

Optimize bitmaps for more memory-efficiency #267

Merged
merged 5 commits into from
Jan 31, 2024
Merged

Optimize bitmaps for more memory-efficiency #267

merged 5 commits into from
Jan 31, 2024

Conversation

Taepper
Copy link
Collaborator

@Taepper Taepper commented Jan 30, 2024

The very memory efficient mode is now implemented:
The most numerous bitmap is deleted instead of flipped. When looking up values, all other bitmaps are considered instead.

A good next step would be a hybrid mode, where the deletion is only preferred over flipping, if there is substantial memory gains, as the performance impact is quite high

Copy link
Contributor

@fengelniederhammer fengelniederhammer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just have a couple of question, but otherwise seems fine.

Is it really worth the trouble though? The reduction of the size numbers in the tests doesn't seem overwhelming...

include/silo/common/aa_symbols.h Show resolved Hide resolved
src/silo/storage/database_partition.cpp Outdated Show resolved Hide resolved
src/silo/storage/position.cpp Outdated Show resolved Hide resolved
src/silo/storage/position.test.cpp Outdated Show resolved Hide resolved
src/silo/query_engine/filter_expressions/or.cpp Outdated Show resolved Hide resolved
src/silo/query_engine/actions/mutations.cpp Outdated Show resolved Hide resolved
src/silo/query_engine/actions/mutations.cpp Outdated Show resolved Hide resolved
src/silo/query_engine/actions/fasta_aligned.cpp Outdated Show resolved Hide resolved
@Taepper
Copy link
Collaborator Author

Taepper commented Jan 30, 2024

I see your point that the effect seems small for the test data set if one looks only at storage consumption. There the static overhead mostly hides the effect because of the few sequences. Although, looking at the values_store_in_X_container shows the rather big savings already. It will be much more apparent for bigger datasets, where the effect will be closer to 90%.

Copy link
Contributor

@fengelniederhammer fengelniederhammer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +85 to +93
const auto deleted_symbol = current_position.getDeletedSymbol();
if (deleted_symbol.has_value() && symbol != *deleted_symbol) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this different from !current_position.isSymbolDeleted(symbol)?

Comment on lines +58 to +59
bitmap.runOptimize();
bitmap.shrinkToFit();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know whether it's good to hide this side effect in a getSomething method.

Comment on lines 137 to 142
for (const uint32_t idx : *filter) {
const roaring::Roaring& n_bitmap = sequence_store_partition.missing_symbol_bitmaps[idx];
if (n_bitmap.contains(position)) {
count_of_mutations_per_position[*deleted_symbol][position] -= 1;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, let's inline this into addPositionToMutationCountsForMixedBitmaps and get rid of the separate correct... method.

@Taepper Taepper merged commit a340b2c into main Jan 31, 2024
2 of 6 checks passed
@Taepper Taepper deleted the optimize-bitmaps branch January 31, 2024 10:11
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.

2 participants