Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparison with CircularArrays.jl #2

Closed
drrmmng opened this issue Aug 5, 2021 · 4 comments · Fixed by #3
Closed

Comparison with CircularArrays.jl #2

drrmmng opened this issue Aug 5, 2021 · 4 comments · Fixed by #3

Comments

@drrmmng
Copy link

drrmmng commented Aug 5, 2021

Hi,
how does this package compare to CircularArrays.jl?

https://github.com/Vexatos/CircularArrays.jl

@findmyway
Copy link
Member

Well, the difference is obvious, we are Buffers. 😆

It has a fixed size and features circular indexing (periodic boundary conditions) across all dimensions: Indexing and assigning beyond its bounds in both directions is possible, as the end of the array is considered adjacent to its start.

Based on the description above from CircularArrays.jl, a CircularArray has a fixed size. In comparison, CircularArrayBuffer has a variable size with a pre-allocated buffer. You can push! elements into it. And when the buffer is full, the oldest data will be overridden. I think this package is more close to the CircularBuffer in DataStructures.jl, except that when dealing with Arrays, we use a pre-allocated continuous array as the underlying storage instead of a Vector.

@drrmmng
Copy link
Author

drrmmng commented Aug 5, 2021

Thank you for your quick answer!

I tried your package and it is pretty cool!
Would it be possible (and feasible) to add an append! function behaving similar to that of CircularBuffer in DataStructures.jl?

Also did you consider adding this type to DataStructures.jl?
That could improve the visibility of this package quite a bit.
Btw: I found it by luck when using autocompletion on "CircularA" when wanting to install CircularArrays (however, your package is what I actually required).

@findmyway
Copy link
Member

Would it be possible (and feasible) to add an append! function behaving similar to that of CircularBuffer in DataStructures.jl?

Yes, of course. Could you be more specific about the signature of append!?

  • Like append!(buffer::CircularArrayBuffer, xs::Vector{<:Array}) to append a vector of elements
  • Or append!(buffer::CircularArrayBuffer, xs::Array) to append a continuous array of elements?

Also did you consider adding this type to DataStructures.jl?

Yes, but it seems they don't want to add more new data structures until v1.0 JuliaCollections/DataStructures.jl#479

Btw: I found it by luck when using autocompletion on "CircularA" when wanting to install CircularArrays (however, your package is what I actually required).

I learned something new 😄

@drrmmng
Copy link
Author

drrmmng commented Aug 6, 2021

Also did you consider adding this type to DataStructures.jl?

Yes, but it seems they don't want to add more new data structures until v1.0 JuliaCollections/DataStructures.jl#479

Oh, there seems to be a lot of discussion, I see.

Btw: I found it by luck when using autocompletion on "CircularA" when wanting to install CircularArrays (however, your package is what I actually required).

I learned something new smile

😄

Would it be possible (and feasible) to add an append! function behaving similar to that of CircularBuffer in DataStructures.jl?

Yes, of course. Could you be more specific about the signature of append!?

* Like `append!(buffer::CircularArrayBuffer, xs::Vector{<:Array})` to append a vector of elements

* Or `append!(buffer::CircularArrayBuffer, xs::Array)` to append a continuous array of elements?

For me personally the second case would be more fitting.

@findmyway findmyway linked a pull request Aug 7, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants