Skip to content

Commit 1a70f24

Browse files
committed
typos
1 parent 3faef1c commit 1a70f24

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

_posts/2025-01-19-DOPvsOOP.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Let us define the number of class instances (entities) we will create to test at
5454
const int num_entities = 1000000;
5555
```
5656

57-
### ```Entity_OOP_Bad````
57+
### ```Entity_OOP_Bad```
5858
OOP class with poor attribute ordering, causing padding
5959
Padding will be used to properly align the attributes in memory.
6060
The attribute order is random and does not take into account the size of each data type.
@@ -114,7 +114,7 @@ OOP (Bad Order) Execution time: 0.0066837 seconds
114114

115115
...but that's pretty fast, right? Well... yes, but let's continue going deeper.
116116

117-
### ```Entity_OOP_Good````
117+
### ```Entity_OOP_Good```
118118
OOP class with proper attribute ordering, minimizing padding
119119
Here, padding is reduced by grouping similar types together.
120120
The attributes are reordered from largest to smallest size (first double, then float, followed by int, char, and finally bool).
@@ -134,8 +134,8 @@ public:
134134
uint16_t something2; // 2 bytes
135135
char id; // 1 byte
136136
bool active; // 1 byte
137-
// _______
138-
// 56 bytes total, alignment 8 bytes
137+
// _______
138+
// 56 bytes total, alignment 8 bytes
139139
};
140140

141141
atributes mAtributes;
@@ -176,7 +176,7 @@ Again a better result. This indicates that we are not thinking nonsense, but we
176176
> [!NOTE]
177177
> Con el comando ```$ lscpu``` you can view the information about my CPU, to see the size in bytes that the CPU queries in each cycle, in order to know how to maximize the efficiency of my structure to avoid unnecessary gaps and perform operations in the fewest number of cycles (L1 and L2 cache sizes, 64-bit data bus size, etc.).
178178
179-
### ```Entity_OOP_GoodWithFooPadding````
179+
### ```Entity_OOP_GoodWithFooPadding```
180180
Now we manually add the necessary padding to align the data with the 64-bit boundaries of our CPU's memory architecture:
181181
```cpp
182182
class Entity_OOP_GoodWithFooPadding {

0 commit comments

Comments
 (0)