You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -229,7 +238,7 @@ OOP (Good Order by DOP and Foo Padding) CPU cycles: 14294218
229
238
OOP (Good Order by DOP and Foo Padding) Execution time: 0.00531921 seconds
230
239
```
231
240
232
-
Even faster. We have found an evidence to the presented hypotesis. Lets summarize the resultd:
241
+
Even faster. We have found an evidence to the presented hypotesis. Let’s summarize the resultd:
233
242
234
243
```cpp
235
244
std::cout << "With DOP, the processing is " << (elapsedOOPBad.count() - elapsedOOPDOP.count()) * 1e3 << " ms faster\n";
@@ -251,6 +260,70 @@ Below are the graph results after running the test many (1000) times and analyzi
251
260
252
261
Mostly, the results align with what was experienced before; careful structuring of variables in memory enhances performance on both small and large scales, even with the optimizations that modern compilers may add.
253
262
263
+
### Compiler customization
264
+
Let’s be more austere. In the following, we will enable some [compiler flags](https://caiorss.github.io/C-Cpp-Notes/compiler-flags-options.html) for the g++ (GCC) compiler and analyze whether the graphs vary significantly or not. We are using ```Qt 6.8.1``` and specifying the flags in the ```.pro``` file via the ```QMAKE_CXXFLAGS`` variable.
Modern CPUs access memory in blocks (typically 8 bytes or more). If the data is properly aligned in memory, access is faster because it can load and store the data in a single memory cycle. If the data is not properly aligned, the CPU may have to perform more memory accesses, which introduces performance penalties due to the need to correct the alignment at runtime.
0 commit comments