WIP Make LongSequence and LongSubSeq use Memory [DO NOT MERGE] #317
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This makes these two data types more lightweight, requiring only two memory allocations (one for the sequence and one for its memory) as opposed to two. It also improves data locality since loading from the sequences won't require a double load through the indirection of
Vector
.The disadvanges are twofold:
First, we lose support for Julia 1.10 since Memory was introduced in Julia 1.11
Second, Vector's code to grow its underlying memory is much more optimised and tested than the manual implementation here in BioSequences. This would matter if users did a lot of resizing operations on biosequences, like
push!
or so. However, I think they don't - they are instead much more likely to create a lot of sequences.If necessary, we can always implement better resizing / growth behaviour for these types.
TODO
pushfirst!
is O(N)