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
Elaborately optimized code is usually larger and harder to change than unoptimized code.
10592
10592
10593
10593
???
10594
10594
10595
-
### <a name="Rper-critical"></a>PER.3: Don't optimize something that's not performance critical
10595
+
### <a name="Rper-critical"></a>Per.3: Don't optimize something that's not performance critical
10596
10596
10597
10597
##### Reason
10598
10598
@@ -10605,10 +10605,10 @@ If your program spends most of its time waiting for the web or for a human, opti
10605
10605
Put another way: If your program spends 4% of its processing time doing
10606
10606
computation A and 40% of its time doing computation B, a 50% improvement on A is
10607
10607
only as impactful as a 5% improvement on B. (If you don't even know how much
10608
-
time is spent on A or B, see <a href="#Rper-reason">PER.1</a> and <a
10609
-
href="#Rper-Knuth">PER.2</a>.)
10608
+
time is spent on A or B, see <a href="#Rper-reason">Per.1</a> and <a
10609
+
href="#Rper-Knuth">Per.2</a>.)
10610
10610
10611
-
### <a name="Rper-simple"></a>PER.4: Don't assume that complicated code is necessarily faster than simple code
10611
+
### <a name="Rper-simple"></a>Per.4: Don't assume that complicated code is necessarily faster than simple code
10612
10612
10613
10613
##### Reason
10614
10614
@@ -10641,7 +10641,7 @@ Simple code can be very fast. Optimizers sometimes do marvels with simple code
10641
10641
10642
10642
???
10643
10643
10644
-
### <a name="Rper-low"></a>PER.5: Don't assume that low-level code is necessarily faster than high-level code
10644
+
### <a name="Rper-low"></a>Per.5: Don't assume that low-level code is necessarily faster than high-level code
10645
10645
10646
10646
##### Reason
10647
10647
@@ -10653,7 +10653,7 @@ Low-level code sometimes inhibits optimizations. Optimizers sometimes do marvels
10653
10653
10654
10654
???
10655
10655
10656
-
### <a name="Rper-measure"></a>PER.6: Don't make claims about performance without measurements
10656
+
### <a name="Rper-measure"></a>Per.6: Don't make claims about performance without measurements
10657
10657
10658
10658
##### Reason
10659
10659
@@ -10673,55 +10673,55 @@ Often, you will be surprised.
10673
10673
10674
10674
???
10675
10675
10676
-
### <a name="Rper-type"></a>PER.10: Rely on the static type system
10676
+
### <a name="Rper-type"></a>Per.10: Rely on the static type system
10677
10677
10678
10678
##### Reason
10679
10679
10680
10680
Type violations, weak types (e.g. `void*`s), and low level code (e.g., manipulation of sequences as individual bytes) make the job of the optimizer much harder. Simple code often optimizes better than hand-crafted complex code.
10681
10681
10682
10682
???
10683
10683
10684
-
### <a name="Rper-Comp"></a>PER.11: Move computation from run time to compile time
10684
+
### <a name="Rper-Comp"></a>Per.11: Move computation from run time to compile time
@@ -10741,7 +10741,7 @@ Performance is very sensitive to cache performance and cache algorithms favor si
10741
10741
for (int c = 0; c < cols; ++c)
10742
10742
sum += matrix[r][c];
10743
10743
10744
-
### <a name="Rper-context"></a>PER.30: Avoid context switches on the critical path
10744
+
### <a name="Rper-context"></a>Per.30: Avoid context switches on the critical path
10745
10745
10746
10746
???
10747
10747
@@ -15853,7 +15853,7 @@ Thanks to the many people who contributed rules, suggestions, supporting informa
15853
15853
15854
15854
and see the contributor list on the github.
15855
15855
15856
-
# <a name="S-profile"></a>PRO: Profiles
15856
+
# <a name="S-profile"></a>Pro: Profiles
15857
15857
15858
15858
A "profile" is a set of deterministic and portably enforceable subset rules (i.e., restrictions) that are designed to achieve a specific guarantee. "Deterministic" means they require only local analysis and could be implemented in a compiler (though they don't need to be). "Portably enforceable" means they are like language rules, so programmers can count on enforcement tools giving the same answer for the same code.
15859
15859
@@ -15884,7 +15884,7 @@ To suppress enforcement of a profile check, place a `suppress` annotation on a l
15884
15884
Now `raw_find()` can scramble memory to its heart's content.
15885
15885
Obviously, suppression should be very rare.
15886
15886
15887
-
## <a name="SS-type"></a>PRO.safety: Type safety profile
15887
+
## <a name="SS-type"></a>Pro.safety: Type safety profile
15888
15888
15889
15889
This profile makes it easier to construct code that uses types correctly and avoids inadvertent type punning.
15890
15890
It does so by focusing on removing the primary sources of type violations, including unsafe uses of casts and unions.
0 commit comments