As a C++ developer, I find it quite important to know about things like: “is this code faster?”, “what happens with this code when you use other compiler version?”, “what does the compiler generate for me?” etc.
Even if you don’t feel the same as me and you don’t deem necessary to know all of the above, you should still check out the below tools.
I feel like this is the holy trinity of the C++ tools.
I think that this is a very known tool but nonetheless I will say a few words about it.
You can find it at https://godbolt.org and it’s a tool that allows you to try out your code on different compilers and see what is the actual generated assembly code.
It is an interactive tool that lets you type code in one window and see the results of its compilation in another window.
Using the site should be pretty self-explanatory: by default the left hand pane is the source window and the right hand has the assembly output.
Another great tool that can be found at https://cppinsights.io.
With this, you can see how the compiler is helping you by generating stuff that you don’t need to explicitly code.
You can see if there are any qualifiers added to your function, or what instantiations are generated for templates.
For example, if you were to create a class and define it’s default constructor, you could see that the compiler will make it inline for you.
The last tool in this chain is quick-bench which can be found at https://quick-bench.com.
Quick Bench is a micro benchmarking tool intended to quickly and simply compare the performance of two or more code snippets.
This is using google benchmark so in order to write your own benchmarks you can go to their site and find out in the documentation.