[PATCH] D90010: clang-tidy: Reduce number of stderr write calls

2020-10-28 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment. I imagine, again, the idea is that if you're generating that many warnings that the performance of printing warnings matters, perhaps you're not paying attention to those warnings? you could disable the ones you aren't interested in? Especially if they're being printed

[PATCH] D90010: clang-tidy: Reduce number of stderr write calls

2020-10-27 Thread Hiral via Phabricator via cfe-commits
Hiralo added a comment. Another observation w.r.t. stdout... For example, consider following sample program: #include #include using namespace std; static long long A = 0ull; void f(const std::string& a) { std::cout << a << std::endl; } int main() { } When running clang-tidy on this..

[PATCH] D90010: clang-tidy: Reduce number of stderr write calls

2020-10-27 Thread Hiral via Phabricator via cfe-commits
Hiralo added a comment. JFYI: using --quiet avoids call to following write calls...so that is useful. write(2, "Suppressed ", 11) = 11 write(2, "10703", 5) = 5 write(2, " warnings (", 11) = 11 write(2, "10703", 5) = 5 write(2, " in non-user code", 17) = 17 write(2, ").\n", 3) = 3 write(2, "Use -he

[PATCH] D90010: clang-tidy: Reduce number of stderr write calls

2020-10-26 Thread Hiral via Phabricator via cfe-commits
Hiralo added a comment. In D90010#2355490 , @dblaikie wrote: > By the looks of the code, you may want to call SetBufferSize only (do not > call SetBuffered after that - or it'll go back to the default buffer size of > 0. Oh! I missed it! For examp

[PATCH] D90010: clang-tidy: Reduce number of stderr write calls

2020-10-26 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment. In D90010#2355489 , @Hiralo wrote: > In D90010#2355460 , @dblaikie wrote: > >> In D90010#2355443 , @Hiralo wrote: >> >>> In D90010#2355432

[PATCH] D90010: clang-tidy: Reduce number of stderr write calls

2020-10-26 Thread Hiral via Phabricator via cfe-commits
Hiralo added a comment. In D90010#2355460 , @dblaikie wrote: > In D90010#2355443 , @Hiralo wrote: > >> In D90010#2355432 , @dblaikie wrote: >> >>> Looks like you might be abl

[PATCH] D90010: clang-tidy: Reduce number of stderr write calls

2020-10-26 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment. In D90010#2355443 , @Hiralo wrote: > In D90010#2355432 , @dblaikie wrote: > >> Looks like you might be able to do something like >> "llvm::errs().setBuffered()" ? > > Do we need to set it

[PATCH] D90010: clang-tidy: Reduce number of stderr write calls

2020-10-26 Thread Hiral via Phabricator via cfe-commits
Hiralo added a comment. Tried using llvm::errs().SetBuffered() within printStats()... static void printStats(const ClangTidyStats &Stats) { + llvm::errs().SetBuffered() but still I see below stderr write calls... ... write(2, "10712", 5)= 5 write(2, " warning", 8)

[PATCH] D90010: clang-tidy: Reduce number of stderr write calls

2020-10-26 Thread Hiral via Phabricator via cfe-commits
Hiralo added a comment. In D90010#2355432 , @dblaikie wrote: > Looks like you might be able to do something like > "llvm::errs().setBuffered()" ? Do we need to set it for each function using llvm:errs() (e.g. here printStats() ) OR can it be set once fo

[PATCH] D90010: clang-tidy: Reduce number of stderr write calls

2020-10-26 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment. In D90010#2355421 , @Hiralo wrote: > In D90010#2352556 , @njames93 wrote: > >> Isn't `llvm::errs()` buffered, negating most of the benefit here. > > If it is buffered, we would expect singl

[PATCH] D90010: clang-tidy: Reduce number of stderr write calls

2020-10-26 Thread Hiral via Phabricator via cfe-commits
Hiralo added a comment. In D90010#2352556 , @njames93 wrote: > Isn't `llvm::errs()` buffered, negating most of the benefit here. If it is buffered, we would expect single write call to stderr. But we are seeing 7 write calls! Yes, please suggest how to

[PATCH] D90010: clang-tidy: Reduce number of stderr write calls

2020-10-25 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment. In D90010#2352556 , @njames93 wrote: > Isn't `llvm::errs()` buffered, negating most of the benefit here. +1 to this (the patch description doesn't explain any specific motivation either - whether it's performance (runtime? memor

[PATCH] D90010: clang-tidy: Reduce number of stderr write calls

2020-10-25 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment. Isn't `llvm::errs()` buffered, negating most of the benefit here. Also using std::string here is bad, its potentially going to allocate and reallocate memory each time it grows. It would be better off using an `llvm::SmallString` and looking at what could potentially be

[PATCH] D90010: clang-tidy: Reduce number of stderr write calls

2020-10-22 Thread Hiral via Phabricator via cfe-commits
Hiralo created this revision. Hiralo added reviewers: alexfh, njames93, hokein, DmitryPolukhin, djasper, ilya-biryukov. Hiralo added a project: clang-tools-extra. Herald added a project: clang. Herald added a subscriber: cfe-commits. Hiralo requested review of this revision. commit c3fa7da502d6cc