STL icon indicating copy to clipboard operation
STL copied to clipboard

Optimize `println()` overloads added in P3142R0

Open frederick-vs-ja opened this issue 1 year ago • 1 comments

Fixes #4630.

  • Add a function __std_print_newline_only_to_unicode_console to the import library to avoid potential branches around WriteConsoleW.
  • Use sputc for non-Unicode new line printing for ostream to reduce potential branches.
  • Use fputc for non-Unicode new line printing for FILE* as the function seems to be the simplest for the purpose in UCRT.

frederick-vs-ja avatar May 12 '24 08:05 frederick-vs-ja

I've pushed a conflict-free merge with main to pick up the 17.12p2 / Clang 18 toolset update. (This isn't usually critical, but it was a big reformatting PR.) No clang-format regeneration was necessary.

StephanTLavavej avatar Sep 12 '24 03:09 StephanTLavavej

Thanks! :heart_eyes_cat: I pushed a conflict-free merge with main followed by several refactorings, shrinking the diff from +181 -2 to +115 -10. Originally, this PR looked like it was adding significant complexity, but now I like where it ended up. I'd still like @CaseyCarter to look at this.

StephanTLavavej avatar Oct 22 '24 15:10 StephanTLavavej

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

StephanTLavavej avatar Oct 23 '24 19:10 StephanTLavavej

Thanks for figuring out the surprisingly complicated logic needed to make these functions fast! :rocket: :heart_eyes_cat: :green_heart:

StephanTLavavej avatar Oct 24 '24 14:10 StephanTLavavej