Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Clang spell checker is slow #17697

Open Quuxplusone opened 11 years ago

Quuxplusone commented 11 years ago
Bugzilla Link PR17698
Status NEW
Importance P normal
Reported by Óscar Fuentes (ofv@wanadoo.es)
Reported on 2013-10-25 14:09:14 -0700
Last modified on 2019-07-11 15:52:57 -0700
Version trunk
Hardware PC Linux
CC jryans@gmail.com, llvm-bugs@lists.llvm.org, rafael@espindo.la
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
This test case:

#include "boost/asio.hpp"
double mainf();
int mainf() {
  foo(sdafo_2, 0);
  return 0;
}

takes this time to compile:

Time (seconds)  Command
6.8             clang -c -std=c++11 test.cpp
4.8             clang -c test.cpp

    (after replacing `sdafo_2' with `x')
1.0             clang -c test.cpp

    (after replacing `sdafo_2' with `o_2')
2.8             clang -c test.cpp

Note how Clang needs a long time to compute the diagnostic about `sdafo_2'
after reporting the diagnostic about the illegal overload of `mainf'.
Quuxplusone commented 11 years ago

Forgot to mention that compiling the preprocessed source halves the compile time. That is, preprocessing and then compiling the resulting output takes half the time of compiling the original file.

Quuxplusone commented 11 years ago

-fno-spell-checking makes the slowness go away.

Quuxplusone commented 11 years ago

Just to add one more data point to this issue: after making a simple change on a C++ source file, clang seemed stuck while compiling it. After 2 minutes I killed the process thinking that it was in a infinite loop. Then remembered this issue and tried to compile with g++. Sure enough, there was a typo introduced by the change. After fixing the typo clang compiled the C++ file in a few seconds.