Skip to content

Commit

Permalink
Add a small freelist to Sequence to reduce creation/deletion in rea…
Browse files Browse the repository at this point in the history
…ding loops
  • Loading branch information
althonos committed Nov 18, 2020
1 parent de40755 commit 4e07208
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pyhmmer/easel.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ to facilitate the development of biological software in C. It is used by

# --- C imports --------------------------------------------------------------

cimport cython
from libc.stdint cimport uint32_t
from libc.stdlib cimport malloc
from libc.string cimport memmove, strdup, strlen
Expand Down Expand Up @@ -283,6 +284,7 @@ cdef class KeyHash:
return new


@cython.freelist(4)
cdef class Sequence:
"""An abstract biological sequence with some associated metadata.
Expand Down Expand Up @@ -444,6 +446,10 @@ cdef class TextSequence(Sequence):
cdef class DigitalSequence(Sequence):
"""A biological sequence stored in digital mode.
Currently, objects from this class cannot be instantiated directly. Use
`TextSequence.digitize` to obtain a digital sequence from a sequence in
text mode.
Attributes:
alphabet (`Alphabet`, *readonly*): The biological alphabet used to
encode this sequence to digits.
Expand Down

0 comments on commit 4e07208

Please sign in to comment.