[Qt-creator] Performance of the editor (with clang-format)
Björn Schäpers
qt-maillist at hazardy.de
Thu May 11 22:35:07 CEST 2023
Hi there,
I recently got a new machine at work, sadly with a new(ly configured) anti virus
software. And the performance of QtCreator when editing went down. I thought the
anti virus was to blame (in a way it is, because if it's deactivated everything
is fine again), but when I debugged something in the creator I made a horrible
observation.
If you use the clang-format plugin in every paint event of an editor the
clang-format style is read, that explains the delay with the anti virus, it just
has to check the .clang-format file if it is bad now...
Here the stacktrace:
1 ClangFormat::ClangFormatBaseIndenter::styleForFile
clangformatbaseindenter.cpp 773 0x7ff833ea5c18
2 ClangFormat::ClangFormatIndenter::tabSettings
clangformatindenter.cpp 68 0x7ff833ed21e7
3 ClangFormat::ClangFormatForwardingIndenter::tabSettings
clangformatindenter.cpp 197 0x7ff833ed27f8
4 CppEditor::Internal::CppEditorDocument::tabSettings
cppeditordocument.cpp 436 0x7ffff44a13ae
5 TextEditor::Internal::PaintEventData::PaintEventData
texteditor.cpp 456 0x7ff816ff71cf
6 TextEditor::TextEditorWidget::paintEvent
texteditor.cpp 4877
0x7ff816f82fca
It's really nice that I can edit my .clang-format file and immediately use that
when pressing ctrl+i, so I understand to read the file in such a situation. But
do we really need that check in the paint event?
Can't we cache the TabSettings? And emit a signal, when the file is read again
and the value changed?
When I click into another editor (split view) or press F4 I've to wait about 3
seconds before I can continue to work.
Kind regards,
Björn.
More information about the Qt-creator
mailing list