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

Add a cheap HistoryBuffer::empty method #432

Closed
Eugeny opened this issue Dec 28, 2023 · 2 comments
Closed

Add a cheap HistoryBuffer::empty method #432

Eugeny opened this issue Dec 28, 2023 · 2 comments

Comments

@Eugeny
Copy link

Eugeny commented Dec 28, 2023

Currently there's no easy way to drain a HistoryBuffer without zeroing it.

A simple function like this would come in handy in performance critical situations:

fn empty(&mut self) {
  self.write_at = 0;
  self.filled = false;
}
@Dirbaio
Copy link
Member

Dirbaio commented Jan 1, 2024

@Eugeny could you share a snippet of code where clear() is causing slow zeroing of the buffer, and your proposed empty() doesn't, when building with optimizations?

From some quick testing, both optimize to the same asm code.

@reitermarkus
Copy link
Member

Closing due to no response and clear already producing the same code.

@reitermarkus reitermarkus closed this as not planned Won't fix, can't repro, duplicate, stale Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants