Discussion:
[Qt-creator] clangbackend slow code completion
Steve Atkins
2018-02-13 23:33:56 UTC
Permalink
I'm using Creator 4.6.0-beta1 on a current generation macbook pro, and code completion is painfully slow - it'll take four or five seconds to complete anything. While it's doing so clangbackend will ramp up to 200% CPU.

It's a reasonably simple project - less than 6,000 lines of code across about 60 files. The completion, and everything else connected to the code model seems to be working fine, it's just CPU intensive and slow.

Is this just how the clang backend is at the moment, or should I be looking for misconfiguration or other problems?

Cheers,
Steve
Nikos Chantziaras
2018-02-14 00:00:29 UTC
Permalink
If you have the "clang-tidy" checks enabled, disable them, or only use 1
or 2 of them. That feature is extremely slow.


On 14/02/18 01:33, Steve Atkins wrote:
> I'm using Creator 4.6.0-beta1 on a current generation macbook pro, and code completion is painfully slow - it'll take four or five seconds to complete anything. While it's doing so clangbackend will ramp up to 200% CPU.
>
> It's a reasonably simple project - less than 6,000 lines of code across about 60 files. The completion, and everything else connected to the code model seems to be working fine, it's just CPU intensive and slow.
>
> Is this just how the clang backend is at the moment, or should I be looking for misconfiguration or other problems?
>
> Cheers,
> Steve
>
Steve Atkins
2018-02-14 00:04:14 UTC
Permalink
> On Feb 13, 2018, at 4:00 PM, Nikos Chantziaras <***@gmail.com> wrote:
>
> If you have the "clang-tidy" checks enabled, disable them, or only use 1 or 2 of them. That feature is extremely slow.

That fixes it, thanks. Bit of a shame, as they were rather a nice feature.

Cheers,
Steve

>
>
> On 14/02/18 01:33, Steve Atkins wrote:
>> I'm using Creator 4.6.0-beta1 on a current generation macbook pro, and code completion is painfully slow - it'll take four or five seconds to complete anything. While it's doing so clangbackend will ramp up to 200% CPU.
>> It's a reasonably simple project - less than 6,000 lines of code across about 60 files. The completion, and everything else connected to the code model seems to be working fine, it's just CPU intensive and slow.
>> Is this just how the clang backend is at the moment, or should I be looking for misconfiguration or other problems?
>> Cheers,
>> Steve
>
>
> _______________________________________________
> Qt-creator mailing list
> Qt-***@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator
Konstantin Tokarev
2018-02-14 12:47:51 UTC
Permalink
14.02.2018, 03:04, "Steve Atkins" <***@blighty.com>:
>>  On Feb 13, 2018, at 4:00 PM, Nikos Chantziaras <***@gmail.com> wrote:
>>
>>  If you have the "clang-tidy" checks enabled, disable them, or only use 1 or 2 of them. That feature is extremely slow.
>
> That fixes it, thanks. Bit of a shame, as they were rather a nice feature.

There are 2 approaches to this problem:
* use faster CPU
* make clang-tidy itself faster

>
> Cheers,
>   Steve
>
>>  On 14/02/18 01:33, Steve Atkins wrote:
>>>  I'm using Creator 4.6.0-beta1 on a current generation macbook pro, and code completion is painfully slow - it'll take four or five seconds to complete anything. While it's doing so clangbackend will ramp up to 200% CPU.
>>>  It's a reasonably simple project - less than 6,000 lines of code across about 60 files. The completion, and everything else connected to the code model seems to be working fine, it's just CPU intensive and slow.
>>>  Is this just how the clang backend is at the moment, or should I be looking for misconfiguration or other problems?
>>>  Cheers,
>>>    Steve
>>
>>  _______________________________________________
>>  Qt-creator mailing list
>>  Qt-***@qt-project.org
>>  http://lists.qt-project.org/mailman/listinfo/qt-creator
>
> _______________________________________________
> Qt-creator mailing list
> Qt-***@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator

--
Regards,
Konstantin
Guenter Schwann
2018-02-14 13:00:53 UTC
Permalink
On Mittwoch, 14. Februar 2018 13:47:51 CET Konstantin Tokarev wrote:
> 14.02.2018, 03:04, "Steve Atkins" <***@blighty.com>:
> >> On Feb 13, 2018, at 4:00 PM, Nikos Chantziaras <***@gmail.com> wrote:
> >>
> >> If you have the "clang-tidy" checks enabled, disable them, or only use 1
> >> or 2 of them. That feature is extremely slow.>
> > That fixes it, thanks. Bit of a shame, as they were rather a nice feature.
>
> There are 2 approaches to this problem:
> * use faster CPU
> * make clang-tidy itself faster

Or
* run clang-tidy/clazy "outside" of the code-model in a separate step in
QtCreator?
* run clang-tidy/clazy only when triggered (menu entry - like the for example
the clang power tools in VS)

Btw. - it would be nice if the QtCreator clang-tidy plugin would (optionally)
make use of a .clang-tidy config file (to share it with clang power tools for
example).

Regards
Guenter
Ivan Donchevskii
2018-02-14 13:08:48 UTC
Permalink
Btw. - it would be nice if the QtCreator clang-tidy plugin would (optionally)
make use of a .clang-tidy config file (to share it with clang power tools for
example).

It's definitely in our plans. We've already discussed how we can support different ways of configuring tidy (with file and with ui options).
Making separate tool for tidy/clazy (to run them like static analyzer on the whole project) is also in plans but we have to solve some technical things on the way to it.

Regards,
Ivan

________________________________
From: Qt-creator <qt-creator-bounces+ivan.donchevskii=***@qt-project.org> on behalf of Guenter Schwann <***@schwann.at>
Sent: Wednesday, February 14, 2018 2:00 PM
To: qt-***@qt-project.org
Subject: Re: [Qt-creator] clangbackend slow code completion

On Mittwoch, 14. Februar 2018 13:47:51 CET Konstantin Tokarev wrote:
> 14.02.2018, 03:04, "Steve Atkins" <***@blighty.com>:
> >> On Feb 13, 2018, at 4:00 PM, Nikos Chantziaras <***@gmail.com> wrote:
> >>
> >> If you have the "clang-tidy" checks enabled, disable them, or only use 1
> >> or 2 of them. That feature is extremely slow.>
> > That fixes it, thanks. Bit of a shame, as they were rather a nice feature.
>
> There are 2 approaches to this problem:
> * use faster CPU
> * make clang-tidy itself faster

Or
* run clang-tidy/clazy "outside" of the code-model in a separate step in
QtCreator?
* run clang-tidy/clazy only when triggered (menu entry - like the for example
the clang power tools in VS)

Btw. - it would be nice if the QtCreator clang-tidy plugin would (optionally)
make use of a .clang-tidy config file (to share it with clang power tools for
example).

Regards
Guenter
Nikos Chantziaras
2018-02-14 17:05:36 UTC
Permalink
Shouldn't all this actually be using clangd?

https://clang.llvm.org/extra/clangd.html


On 14/02/18 15:08, Ivan Donchevskii wrote:
>
> Btw. - it would be nice if the QtCreator clang-tidy plugin would
> (optionally)
> make use of a .clang-tidy config file (to share it with clang power
> tools for
> example).
>
> It's definitely in our plans. We've already discussed how we can support
> different ways of configuring tidy (with file and with ui options).
> Making separate tool for tidy/clazy (to run them like static analyzer on
> the whole project) is also in plans but we have to solve some technical
> things on the way to it.
>
> Regards,
> Ivan
Marco Bubke
2018-02-14 17:19:46 UTC
Permalink
We are looking into implementing the language server protocol but that is not so important now.


For the speed problem, we have an idea how we can improve it but we don't want to add it in 4.6 because it could can break something.

________________________________
From: Qt-creator <qt-creator-bounces+marco.bubke=***@qt-project.org> on behalf of Nikos Chantziaras <***@gmail.com>
Sent: Wednesday, February 14, 2018 6:05:36 PM
To: qt-***@qt-project.org
Subject: Re: [Qt-creator] clangbackend slow code completion

Shouldn't all this actually be using clangd?

https://clang.llvm.org/extra/clangd.html


On 14/02/18 15:08, Ivan Donchevskii wrote:
>
> Btw. - it would be nice if the QtCreator clang-tidy plugin would
> (optionally)
> make use of a .clang-tidy config file (to share it with clang power
> tools for
> example).
>
> It's definitely in our plans. We've already discussed how we can support
> different ways of configuring tidy (with file and with ui options).
> Making separate tool for tidy/clazy (to run them like static analyzer on
> the whole project) is also in plans but we have to solve some technical
> things on the way to it.
>
> Regards,
> Ivan
Steve Atkins
2018-02-14 17:25:28 UTC
Permalink
> On Feb 14, 2018, at 5:00 AM, Guenter Schwann <***@schwann.at> wrote:
>
> On Mittwoch, 14. Februar 2018 13:47:51 CET Konstantin Tokarev wrote:
>> 14.02.2018, 03:04, "Steve Atkins" <***@blighty.com>:
>>>> On Feb 13, 2018, at 4:00 PM, Nikos Chantziaras <***@gmail.com> wrote:
>>>>
>>>> If you have the "clang-tidy" checks enabled, disable them, or only use 1
>>>> or 2 of them. That feature is extremely slow.>
>>> That fixes it, thanks. Bit of a shame, as they were rather a nice feature.
>>
>> There are 2 approaches to this problem:
>> * use faster CPU
>> * make clang-tidy itself faster
>
> Or
> * run clang-tidy/clazy "outside" of the code-model in a separate step in
> QtCreator?
> * run clang-tidy/clazy only when triggered (menu entry - like the for example
> the clang power tools in VS)

Yes, something like that seems the only way clang-tidy + Creator will be usable,
unless clang-tidy gets at least an order of magnitude faster or 30GHz processors
hit the market.

Asynchronous code checks would be a killer feature.

(I'd assumed that was the way it would be implemented - that clang tidy
checks wouldn't be related to basic completion - otherwise I'd have thought
to try turning them off to fix completion).

> Btw. - it would be nice if the QtCreator clang-tidy plugin would (optionally)
> make use of a .clang-tidy config file (to share it with clang power tools for
> example).

Yes, and that'd let you be more selective with which checks to enable
too.

Cheers,
Steve
Loading...