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

feat: avoid copying in Band #1

Merged
merged 1 commit into from
Sep 30, 2023
Merged

feat: avoid copying in Band #1

merged 1 commit into from
Sep 30, 2023

Conversation

nfejzic
Copy link
Owner

@nfejzic nfejzic commented Sep 30, 2023

Band is implemented by using an array internally. Previously, when expanding or progressing the Band the items inside it were shifted by one. This was done to always keep the array filled from the start (from index 0). This commit changes the implementation of the Band, so that the elements can also start from anywhere in the array and wrap around it. This means that the head of array can be at the middle for example, and the last element in the Band is the one before the head in the array. This avoids unnecessary copying, and works with cheap index operations.

`Band` is implemented by using an array internally. Previously, when
expanding or progressing the `Band` the items inside it were shifted by
one. This was done to always keep the array filled from the start (from
index 0). This commit changes the implementation of the `Band`, so that
the elements can also start from anywhere in the array and wrap around
it. This means that the head of array can be at the middle for example,
and the last element in the `Band` is the one before the head in the
array. This avoids unnecessary copying, and works with cheap index
operations.
@nfejzic nfejzic merged commit ee9eeba into main Sep 30, 2023
2 checks passed
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 this pull request may close these issues.

None yet

1 participant