-
Notifications
You must be signed in to change notification settings - Fork 82
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
[Alphabet] seqan3::concatenated_sequences benchmark #2951
Comments
Note that you need to get out of the realm of CPU caches for the benchmark to be meaningful! |
@h-2 Is that something we have to do in every single benchmark (like this one) or some over all adaptation? |
While you were commenting, I was editing the issue – I thought the same and already added a few sentences. However, I'm not so knowledgeable as to what cache level I need to escape — surely L1 and L2; what about L3? And what would be good sizes to securely achieve this? We should be good with 8 MiB for L2, right? @h-2 do you know from the top of your head? Otherwise, I would just consider it a research task for this issue 😁 |
I am not sure. Maybe try with sizes similar to the other benchmarks first and see if that produces interesting results or not. I think there were plans for "macro-benchmarks" at some point and this could be part of one, but that maybe does not have to happen now. |
The cache sizes vary a lot. I just wanted to point out that I have seen very significant speed improvements with the change. In the range of 50% speed-up for overall runtime of my program. And the concat_sequences can be 100s of MBs in my program, so I don't know if similar speed-ups are visible when everything fits in the cache. edit: the reported 50% speed-gain is for switching from vector-of-vector to concat_seqs, so definitely not just because of the change. |
I'm sure it's faster, but we need a benchmark at the very least for regression testing :D I would just test a tiny size (let's say |
If you are benchmarking random-access-reads (unrelated to the changes from my PR), I would actually recommend creating a large sequence (say 100MB total off 1000 subseqs of 100KB each) and reading from that. Creating the sequence can be performed before the benchmark. |
Description
seqan3::concatenated_sequences
is a container that is supposed to be more efficient when using "static" input data (many read operations, few to no write operations)In contrast to a
std::vector<std::vector>
, where each inner vector does its own allocation,seqan3::concatenated_sequences
stores the data in contiguous memory. In theory, this leads to fewer cache misses when accessing the data structure, and access should be hence faster.But we never have tested this advantage.
#2947 introduced member functions for efficient
push_back
. The efficiency ofpush_back
should also be tested.Tasks
General Considerations
Choose some appropriate size(s) (inspiration). If the whole data structure fits into the CPU cache, we cannot see how fast "actual memory" access is.
Since the "big" benchmarks might take quite a while in Debug (Nightlies), you can set different sizes for Release (used for actual benchmarking) and Debug (Nightlies).
For an example, see how we did it in the format_sam_benchmark.
Benchmarking Access
For both
std::vector<seqan3::dna4>
andstd::string
(=underlying_container_t
), write a benchmark that measures many (random access) read operationsseqan3::concatenated_sequences<underlying_container_t>
std::vector<underlying_container_t>
Benchmarking Appending
For both
std::vector<seqan3::dna4>
andstd::string
(=underlying_container_t
), write a benchmark that measures manypush_back
operationsseqan3::concatenated_sequences<underlying_container_t>
² - the old way before #2947seqan3::concatenated_sequences<underlying_container_t>
³ - the new way after #2947std::vector<underlying_container_t>
- should accomplish same task as shown in ² and ³Footnotes
¹ Notes regarding SeqAn2
seqan::StringSet<TString, seqan::Owner<seqan::ConcatDirect>>
std::string
equivalent in SeqAn2 isseqan::CharString
std::vector<seqan3::dna4>
equivalent in SeqAn2 isseqan::DnaString
² Example code for old way
³ Example code for new way
The text was updated successfully, but these errors were encountered: