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

Efficient use of devector as queue or stack. #299

Open
karl3wm opened this issue Feb 18, 2025 · 0 comments
Open

Efficient use of devector as queue or stack. #299

karl3wm opened this issue Feb 18, 2025 · 0 comments

Comments

@karl3wm
Copy link

karl3wm commented Feb 18, 2025

The current policy of devector is to move the data to the middle of the allocated region whenever capacity is needed on an end.

This results in half of the free capacity being wasted when only one end of the devector is used.

Instead, the policy for free capacity for the devector should be configurable separately for each end.

This would make it easy to provide configurations for contiguous queues.

Additionally, the functions to reserve capacity in the front or back always allocate if space is needed. Instead, if sufficient capacity per the policy is available on the other end, the data could be moved without the new allocation. This is most appropriate for queues which have need of capacity on only one end.

Avoiding problems like this would ideally be done by parameterizing the algorithmic choices of devector into general policies.

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

No branches or pull requests

1 participant