DataStructures.jl icon indicating copy to clipboard operation
DataStructures.jl copied to clipboard

Fixed size container for buffer in CircularDeque

Open artemsolod opened this issue 3 months ago • 1 comments

Would it make sense to switch from Vector as the container for buffer of CircularDeque (and potentially other fixed size containers)? Since we have Memory{T} and FixedSizeArray they could eliminate a pointer jump. Or the performance gain is expected to be negligible?

The concerns I see are:

  • compatibility with older julia versions and
  • Base._unsetindex! trickery required for proper garbage collection as mentioned in https://github.com/JuliaCollections/DataStructures.jl/issues/884 and also discussed in https://github.com/julialang/julia/issues/58943

artemsolod avatar Oct 17 '25 13:10 artemsolod

compatibility with older julia versions

We can always use a

if VERSION < v"1.11"
    const Memory = Vector
end

or something like that

Base._unsetindex!

At least on the current version, this function is also overloaded for Memory.

This seems a fine change as far as the issues go

However, I am not sure if there is any performance or otherwise gain from doing this.

oxinabox avatar Oct 22 '25 03:10 oxinabox