Examples and tutorials for code performance improvements for CPU in C++. For GPGPU check learn-cuda repository.
🧩 Show Classes
(🏗️ : Not started | 📝 : Started | 📑 : Needs proofreading | ✔️ : Written )
Open a command line and run :
git clone --recurse-submodules -j8 https://github.com/learn-computer-graphics/code-optimization.git
You can read the classes listed in the table of contents, but if you want to follow along, you need to install CMake to build the project, and a C++ compiler which handles C++17.
Some projects are using external libraries such as OpenCV, details to install them are detailled below.
sudo apt-get install build-essential cmake libopencv-dev
To get the MSVC compiler, you need to install Visual Studio (and not VSCode), and select C++ development during installation. For additionnal dependencies it is recommanded that you use the official microsoft package manager vcpkg.
vcpkg install opencv
If you use vcpgk, you will need to give its path for the cmake build. Here is an exemple in command line :
cmake -DCMAKE_TOOLCHAIN_FILE=[your vcpkg root]/scripts/buildsystems/vcpkg.cmake
If you use the VSCode editor, you can change the path in .vscode/settings.json
. Beware your installed lib triplets to match your vscode build settings (x86 or x64).
You can handle the CMakeLists.txt
in any way you like, here's some way to use it :
Go to the folder of this project and run :
mkdir build
cd build
cmake ..
make
Open this folder with the CMake...
option in file->open on Visual Studio, and run the project.
Use the CMakeTools
plugin, build with f7
then run with f5
(But be careful to be on the right platform, there is a launch file for windows and for linux).
You can use the Tracy profiler to check the performance of the code. Simply download and run its executable. When opened, click on connect.
Then if you run an executable from this project in admin, Tracy will be able to provide dissassembly information.
If you find errors in the code, or better way to explain or do things, feel free to open an issue !
Name | Description |
---|---|
Intel VTune | CPU profiling with low-level information. Comes with tutorials. |
Visual Studio | IDE with good profiling support. Also allows to check threads loads with an extension. |
Optix | CPU & GPU profiler |
Chrome Tracing | Profiler data viewer |
NVidia Nsight | Frame Debugger & GPU profiler |
RenderDoc | Frame Debugger with some GPU profiling data |
Intel GPA | Frame Debugger & GPU profiler |
Name | Description |
---|---|
C++ High Performance | Comes with a repository of examples |
Name | Description |
---|---|
Software Optimisation Resources | A serie of in-deepth document by Agner Fog on low level CPU architectures and ways to optimise data usage for them. |
Name | Description |
---|---|
What's a creel - Modern x64 assembly | A serie of video on Assembly Language. His channel has also a lot of ressources related to CPU performance. |
Name | Description |
---|---|
Fabian Giesen (ryg) website | A great blog from a great engineer talking about CPU and GPU architectures |
Blog at the bottom of the sea | Alan Wolfe's graphic programming blogs with many articles on performance side |
IT Hare | Various and always high-quality articles for programmers |
Simon Schreibt | Various articles on graphics programming performance tricks for various effects in AAA games |
Joel on software | Various articles with many on performance and best practices by StackOverflow founder |
Name | Description |
---|---|
Profiling processor cache misses | An article Ahmed Mahdy about intel VTune |
Name | Description |
---|---|
Pitfall Of OOP - Revisited | A conference for TGC 2017 by Tony Albrecht on performances |
Name | Description |
---|---|
AwesomePerfCpp | A compilation of greats links on performance optimisation |