Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
> * Remove all unnecessary headers. Template expansion is slow, and preprocessing is even slower. Some of the standard includes (like `` and ``) are notorious for slowing individual translation units to a crawl. `#pragma once` for your own headers also helps with cpp-time performance.
> * Forward-declare as much as you can. Forward type declarations mean that the compiler doesn't need to process all of `Foo` when it sees `Foo&` or `Foo`.
I've found the include-what-you-use (IWYU) tool [1][2] can help immensely with automating this process, especially on large code-bases.
It uses LLVM/Clang to analyze a .cpp file / translation unit and produces the minimal subset of exactly which includes are necessary and what types can be forward declared.
[1] https://include-what-you-use.org/
Also, if you do not use Dash or an open source implementation like Zeal[1] (which is what I use), you are missing out.
The supplied C++ docset comes from cppreference.com and is very, very useful to have to hand.
The Python and CMake docsets are also particularly useful to me.
[1] https://zealdocs.org/
Yeah, at least according to the repo it seems they now delegate to the ccls language server and just do syntax highlighting via the textmate plist grammars that are so commonly paired with language servers
* https://github.com/apache/netbeans/tree/12.3/cpplite#cpplite
* https://github.com/apache/netbeans/blob/12.3/cpplite/cpplite...
> I'm curious if anybody is working to make C++ faster to compile.
Yes - C++20 added support for modules to the Core Language (both "header units" and "named modules"; header units are an intermediate step between classic includes and named modules), and support for header units to the Standard Library. Compiler/library support is a work in progress (MSVC's STL, which I work on, is the furthest along - see https://github.com/microsoft/STL/issues/1694 for status), but header units are showing significant improvements in compiler throughput (build speed). This looks like `import ;` in your source code (with significant build system changes to build vector as a header unit, producing vector.ifc and vector.obj).
There's a proposal under review for C++23 to add named modules for the Standard Library, see https://wg21.link/p2465r2 . If this is accepted, `import std;` (or `import std.compat;`) will be the one-line way to use the entire C++ Standard Library with (what we hope will be) even better compiler throughput.
The primary limitation of header units and especially named modules is macros: neither can be influenced by macros defined in the source file, and named modules can't emit macros at all. Thus, one will still need to `#include ` in addition to `import std;` if you want the `assert()` macro.
qt-creator is a nice open-source IDE:
https://github.com/qt-creator/qt-creator
They offer binary releases, but it's also possible to compile from source without too much trouble. Written in C++, it's pretty snappy. Supports meson.
to give a very flagrant example on a project that i am currently working on:
- GCC build: 4m20 (https://github.com/celtera/avendish/runs/5449993123?check_su...)
- Clang build: 2m40 (https://github.com/celtera/avendish/runs/5449993033?check_su...)