CLion Starts 2019.3 EAP: Performance Improvements, Clangd-based Code Completion & Remote Debug via gdbserver
Today we are launching the Early Access Program (EAP) for CLion 2019.3. We plan to release it by the end of this fall and, as you may remember, it was announced to be a special Quality-targeted Release.
As usual, the EAP builds are free to use and no license is required. The main goal is to test them in all kinds of non-standard or unusual environments you may have set up, and collect and fix as many issues and regressions as possible. So go ahead and grab a fresh build to try it now!
Build 193.3519.24 is available from our site, via the Toolbox App, or as a snap package (if you are using Ubuntu).
- Clangd-based code completion.
- Optimizing Building/Updating symbols step and fixing UI freezes.
- Search only for code usages when doing a Rename refactoring.
- Launching remote targets automatically under gdbserver.
- Microsoft code style, spell checker in CMake and Doxygen comments, and enhancements from the IntelliJ Platform.
Clangd-based code completion
To eliminate performance issues and lags, we continue integrating with the Clangd-based engine in the areas where it provides an advantage. This time it’s code completion.
CLion has several providers for code completion, which now include Clangd. The results are shown to you as soon as they arrive, so usually the first results come from the fastest provider. Clangd however produces the results in batches by 100 options. So in the performance metrics shown below, we’ve measured the time (in ms) to get the first 100 results (or fewer, if there are less than 100 results in total). The measurements were taken on a Core i7-8750H PC with 32 GB of RAM running 64-bit Windows 10.
On regular middle-sized projects, the results turned out to be quite similar for Clangd and CLion. However, on projects with known performance issues and lags due to CLion’s code completion, the results are very encouraging.
First comes LLVM (natural choice as we tend to dogfood CLion for Clangd development in the team!):
For the Eigen library, the acceleration is even more exciting!
A similar (or even better!) boost can be observed for Boost. For example, for
boost::multi_index, nearly any completion for the
multi_index_container is way faster (125 ms on Clangd vs 25,000 ms on CLion’s own engine).
For the Qt library, we observed a reasonable boost as well:
You may ask, “Why do you keep the existing CLion code completion engine at all?” The main reason is that it offers additional results that are not yet possible to achieve with Clangd-based code completion. These include, for example, showing not-yet-included symbols, providing some reasonable hints for dependent code in templates, and so on.
So now, it’s up to you to check Clangd-based code completion on your project and see what kinds of speedups you get. Let us know how it goes!
Optimizing Building/Updating symbols step and fixing UI freezes
As we’ve already shared with you, in June our team ran an internal performance week / hackathon (along with the IntelliJ Platform team), playing with several fresh and brave ideas to improve the IDE’s performance. We focused mainly on optimizing the Building/Updating symbols step. The successful experiments have made their way into this 2019.3 EAP build.
Depending on the project and system characteristics, the boost is 10% to 50%, according to our measurements. This is covered by such tickets as CPP-16552, CPP-16991, CPP-16992, and some others. Note that these results are heavily dependent on the specific project, CPU, and environment you’re using, so please let us know whether you notice any improvements in your setup.
In addition, several UI freezes have been fixed:
- On Safe Delete (CPP-14068)
- With breadcrumbs (CPP-14176)
- While renaming an
- While going to declaration (CPP-17071)
- While Usage View is opened (CPP-17097)
We will continue coming up with various performance improvements and eliminating freezes, so stay tuned!
Search only for code usages when doing a Rename refactoring
Previously, when you called up the Rename refactoring for a variable, CLion first searched for all usages of the variable, including non-code usages such as string literals and comments. Then it suggested choosing between "Rename All Usages" and "Rename Only Code Usages". This could be very time-consuming and not even needed, if you really just wanted to rename only code usages.
Starting now, the Rename refactoring can ask you to make this decision before the actual search. To switch to such behavior, go to Settings/Preferences | Editor | General | Refactorings and turn off the setting ‘Enable in-place mode’ (it’s on by default). Then, when you press
⇧F6, CLion will first suggest the Rename dialog. Clear the checkboxes in this dialog (“Search in comments and strings” and “Search for text occurrences”) so that CLion searches for code usages only:
Launching remote targets automatically under gdbserver
Until now, if you did not use the Full Remote Mode in CLion, but built locally and just wanted to debug an executable running on a remote machine under gdbserver, you had to launch your program under gdbserver manually. Now, the hassle is gone – CLion will do the job for you!
To get it working, create a Remote GDB Server configuration instead of using the GDB Remote Debug configuration. Fill in the credentials of your remote machine and wait for the connection to be established:
Now, if you select this Run/Debug configuration, you can debug on a remote machine via the remote gdbserver.
Among other changes you will find:
- Microsoft’s predefined formatting and naming style was added to the list of predefined styles in CLion:
- To prevent situations when virtual functions accesses the resources that are not yet initialized or have already been destroyed, CLion gets a new inspection that detects virtual functions called from constructors or destructors. (Note! The inspection works only when Clangd is enabled.)
- CMake 3.15 is now bundled.
- Spell Checker now works in CMake and Doxygen comments.
- CLion now bundles the Markdown plugin. Note, that if you have a Markdown Navigator plugin installed, this might cause a known issue. As a workaround, remove the Markdown Navigator from the plugin directory and restart CLion.
- There are lots of improvements coming from the IntelliJ Platform, like smooth mouse scrolling, a timeline for GitHub pull requests, reworked Clone dialog, and many fixes to the JetBrains Runtime. Read about these changes in the IntelliJ IDEA blog.
That’s it for now! Give this build a try and stay tuned for further fixes and improvements!
Your CLion Team
The Drive to Develop