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

perf: avoid using write! macro with single str #228

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

DaniPopes
Copy link
Contributor

@DaniPopes DaniPopes commented Nov 1, 2024

A known issue with write! is that it's slower and generates more code than direct calls to write_str, unfortunately even in the simple case of "{str}". See rust-lang/rust#76490.

I've verified with Godbolt that it is still the case: https://godbolt.org/z/sq3M8xWfo

@DaniPopes DaniPopes changed the title perf(anstyle): avoid using write! macro with single str perf: avoid using write! macro with single str Nov 1, 2024
@coveralls
Copy link

Pull Request Test Coverage Report for Build 11629840392

Details

  • 4 of 4 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.06%) to 51.742%

Totals Coverage Status
Change from base Build 11506573894: -0.06%
Covered Lines: 1218
Relevant Lines: 2354

💛 - Coveralls

@epage epage merged commit 13e008a into rust-cli:main Nov 1, 2024
14 of 15 checks passed
@DaniPopes DaniPopes deleted the avoid-write-macro-str branch November 1, 2024 14:11
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.

3 participants