[PATCH] D138378: [clang-format][NFC] Skip unneeded calculations

2022-12-03 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. The refactoring `std::max(0, C.Spaces)` part still looks good though, but probably it's not worth it to have a patch just for that. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138378/new/ https://reviews.llvm.org/D138378 _

[PATCH] D138378: [clang-format][NFC] Skip unneeded calculations

2022-12-01 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. To my surprise, tools/clang/unittests/Format/FormatTests with the patch ran a little bit slower: | | Run 1 | Run 2 | Run 3 | Average | | w/o patch | 2707ms | 2697ms | 2710ms | 2705ms | | w/ patch | 2720ms | 2719ms | 2724ms | 2721ms | CHANGES SINCE LAST

[PATCH] D138378: [clang-format][NFC] Skip unneeded calculations

2022-12-01 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. I ran (on macOS Ventura) the release build of clang-format 8627811 on the entire clang codebase and saw only a 0.12% reduction in runtime, which is what I expected. | | Run 1 | Run 2 |

[PATCH] D138378: [clang-format][NFC] Skip unneeded calculations

2022-12-01 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks updated this revision to Diff 479189. HazardyKnusperkeks added a comment. Reverted the changes in the switch. We now only have a fast path. On my machine 4 consecutive runs of the clang format unittests, the last three times (as reported by gtest) are: | | Before patch

[PATCH] D138378: [clang-format][NFC] Skip unneeded calculations

2022-11-21 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/WhitespaceManager.cpp:1434-1436 + if (Style.UseTab == FormatStyle::UT_Never) { +ReplacementText.append(Spaces, ' '); + } else { HazardyKnusperkeks wrote: > owenpan wrote: > > Doing this

[PATCH] D138378: [clang-format][NFC] Skip unneeded calculations

2022-11-21 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments. Comment at: clang/lib/Format/WhitespaceManager.cpp:1434-1436 + if (Style.UseTab == FormatStyle::UT_Never) { +ReplacementText.append(Spaces, ' '); + } else { owenpan wrote: > Doing this would lose some of

[PATCH] D138378: [clang-format][NFC] Skip unneeded calculations

2022-11-20 Thread Owen Pan via Phabricator via cfe-commits
owenpan added inline comments. Comment at: clang/lib/Format/WhitespaceManager.cpp:1433 // assert((int)C.StartOfTokenColumn >= C.Spaces); - appendIndentText( - ReplacementText, C.Tok->IndentLevel, std::max(0, C.Spaces), - std::max((int)C.StartOfTokenC

[PATCH] D138378: [clang-format][NFC] Skip unneeded calculations

2022-11-20 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks created this revision. HazardyKnusperkeks added reviewers: owenpan, MyDeveloperDay, rymiel. HazardyKnusperkeks added a project: clang-format. Herald added a project: All. HazardyKnusperkeks requested review of this revision. Herald added a project: clang. Herald added a subscribe