Skip to content

Commit

Permalink
Comment about the efficient printing
Browse files Browse the repository at this point in the history
  • Loading branch information
sampsyo committed Dec 8, 2024
1 parent 810bf87 commit dd5f87b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions flatgfa/src/flatgfa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ fn nucleotide_complement(c: u8) -> u8 {
impl<'a> std::fmt::Display for Sequence<'a> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if self.revcmp {
// For small sequences, it's faster to allocate the reverse-complement
// string and write the whole buffer at once. For larger sequences, it
// may be more efficient to do it one character at a time to avoid an
// allocation? Not sure, but could be worth a try.
let bytes = self.as_vec();
write!(f, "{}", BStr::new(&bytes))?;
} else {
Expand Down

0 comments on commit dd5f87b

Please sign in to comment.