Skip to content

Latest commit

 

History

History
52 lines (36 loc) · 1.95 KB

README.md

File metadata and controls

52 lines (36 loc) · 1.95 KB

C++ Optimization

Skills and techniques for fast and efficient C++ code.


Table of Contents

Techniques

  • Loop Unrolling - a technique to improve performance by reducing loop overhead.

Parallel Programming

  • False Sharing - a performance issue that occurs when multiple threads modify variables that reside on the same cache line.
  • OpenMP - an API that supports shared memory multiprocessing, enabling programmers to easily develop multi-threaded applications for parallel computing.
  • std::async - a high-level interface for managing asynchronous tasks supported by the C++ Standard Library.

Memory and Cache

  • Spatial Locality - a principle that states that if a program accesses a memory location, it is likely to access nearby memory locations in the near future.
  • Temporal Locality - a principle that states that if a program accesses a memory location, it is likely to access the same memory location in the near future.

Getting Started

Requirements

  • C++ compiler with C++20 support

Running the examples

git clone https://github.com/BayernMuller/cpp-optimization
cd cpp-optimization/techniques
./run.sh <example>

Contributing

  • Contributions are welcome! For bug reports, feature requests, or questions, please submit an issue.
  • optimization.cpp is using the Microsoft code style. Please follow this style when contributing.
  • Please add the below command to .git/hooks/pre-commit to run clang-format before committing.
clang-format -i -style=microsoft $(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(cpp|hpp|c|h)$')

License

This project is licensed under the MIT License - see the LICENSE file for details.