Skip to content

Commit

Permalink
perf: mark complement as inline (#510)
Browse files Browse the repository at this point in the history
* mark dna::complement as inline

This speeds up computing the complement on a long string by ~2.3x.

* mark rna::complement as inline
  • Loading branch information
kloetzl committed Jan 2, 2023
1 parent cfb2337 commit bd08234
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/alphabets/dna.rs
Expand Up @@ -62,6 +62,7 @@ lazy_static! {
/// assert_eq!(dna::complement(89), 82); // Y → R
/// assert_eq!(dna::complement(115), 115); // s → s
/// ```
#[inline]
pub fn complement(a: u8) -> u8 {
COMPLEMENT[a as usize]
}
Expand Down
1 change: 1 addition & 0 deletions src/alphabets/rna.rs
Expand Up @@ -62,6 +62,7 @@ lazy_static! {
/// assert_eq!(rna::complement(115), 115); // s → s
/// assert_eq!(rna::complement(78), 78); // N → N
/// ```
#[inline]
pub fn complement(a: u8) -> u8 {
COMPLEMENT[a as usize]
}
Expand Down

0 comments on commit bd08234

Please sign in to comment.