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

Directly write to output instead of local String buffer #63

Merged
merged 1 commit into from
Apr 5, 2023

Conversation

Mark-Simulacrum
Copy link
Member

Previous measurements showed this to be a net loss in performance, but further investigation shows that is likely to be a result of increased syscalls in the test benchmark. Adjusting the benchmark to buffer the output (e.g., with std::io::BufWriter) makes this a win, around 16% faster.

Documentation on demangle_stream is updated to recommend buffering the output writer.

Previous measurements showed this to be a net loss in performance, but
further investigation shows that is likely to be a result of increased
syscalls in the test benchmark. Adjusting the benchmark to buffer the
output (e.g., with std::io::BufWriter) makes this a win, around 16%
faster.

Documentation on demangle_stream is updated to recommend buffering the
output writer.
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh this explains my confusion to the assertion that allocationg a string buffer didn't matter too much.

@alexcrichton alexcrichton merged commit 61c64c3 into rust-lang:main Apr 5, 2023
@Mark-Simulacrum Mark-Simulacrum deleted the direct-write branch April 5, 2023 15:59
@Mark-Simulacrum
Copy link
Member Author

I'll go ahead and make a point release if you have no objections with this change?

@alexcrichton
Copy link
Member

Sounds good!

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.

2 participants