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

Preallocate deque used for the filter window #107

Merged
merged 1 commit into from
Aug 9, 2017

Conversation

jakirkham
Copy link
Member

This is needed on some platforms to ensure that the needed space is already allocated before adding values (e.g. Windows). That said, this should be a bit faster than adding values to the filter window at the time and potentially going through several reallocations in the process. By using this approach, we guarantee that only one allocation occurs when creating and initially filling the deque. Ideally there should be no reallocations in the filter code as we keep this size as an upper bound (though we do go under by 1 periodically).

This is needed on some platforms to ensure that the needed space is
already allocated before adding values (e.g. Windows). That said, this
should be a bit faster than adding values to the filter window at the
time and potentially going through several reallocations in the process.
By using this approach, we guarantee that only one allocation occurs
when creating and initially filling the deque. Ideally there should be
no reallocations in the filter code as we keep this size as an upper
bound (though we do go under by 1 periodically).
@jakirkham jakirkham merged commit 8c26168 into nanshe-org:master Aug 9, 2017
@jakirkham jakirkham deleted the prealloc_deque branch August 9, 2017 03:47
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.

1 participant