-
Notifications
You must be signed in to change notification settings - Fork 51
Description
This is obviously a breaking change, so this is for the far future if it will ever happen.
Currently, LongSequence is resizable: They support operations like:
julia> seq = dna"TAG";
julia> push!(seq, DNA_A)
4nt DNA Sequence:
TAGA
julia> append!(seq, rna"UAGA")
8nt DNA Sequence:
TAGATAGAMy proposal is to remove all methods on LongSequence that changes their size. This includes: resize!, pop!, popfirst!, push!, pushfirst!, filter!, deleteat!, and resizing during copy!.
Disadvantages of proposal
The disadvantages are obvious: Some users may want to do these operations. With my proposed suggestion, users would instead need to use immutable operations, just like if they were working with strings.
But: How often do people actually use these operations? I would guess that they are not used very often.
Advantage
It would allow us to change the storage of LongSequence from:
mutable struct OldSeq
const data::Vector{UInt64}
len::UInt
end
struct NewSeq
data::Memory{UInt64}
len::UInt
endThat is, it would allow making LongSequence a struct instead of a mutable struct, and it would also allow them to use Memory instead of Vector as backing storage. This saves two memory indirections.
More importantly, these indirections may inhibit memory optimisations such as stack-allocating some LongSequence, allocation hoisting, such. Such optimisations will be easier for Julia to do on an immutable struct containing Memory compared to a Memory hiding behind to mutable references.
At the moment, Julia doesn't really have any substantial memory optimisations so at the moment, there won't be much advantage to it.