Skip to content

Commit f3b5367

Browse files
committed
acrolinx
1 parent 0aa62fd commit f3b5367

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docs/build-insights/tutorials/build-insights-function-view.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Use Build Insights **Functions** view to troubleshoot the impact of function inl
1212
## Prerequisites
1313

1414
- Visual Studio 2022 17.8 or greater.
15-
- C++ Build insights is enabled by default if you install either the Desktop development with C++ workload or the Game development with C++ workload.
15+
- C++ Build Insights is enabled by default if you install either the Desktop development with C++ workload or the Game development with C++ workload.
1616

1717
:::image type="complex" source="./media/installer-desktop-cpp-build-insights.png" alt-text="Screenshot of the Visual Studio Installer with the Desktop development with C++ workload selected.":::
1818
The list of installed components is shown. C++ Build Insights is highlighted and is selected which means it's installed.
@@ -61,7 +61,7 @@ When the build finishes, an Event Trace Log (ETL) file opens. It's saved in the
6161

6262
## Function view
6363

64-
In the window for the ETL file, choose the **Functions** tab. It shows the functions that were compiled and the time it took to generate the code for each function. If the amount of code generated for a function is negligible, it won't appear in the list to avoid degrading build event collection performance.
64+
In the window for the ETL file, choose the **Functions** tab. It shows the functions that were compiled and the time it took to generate the code for each function. If the amount of code generated for a function is negligible, it doesn't appear in the list to avoid degrading build event collection performance.
6565

6666
:::image type="complex" source="./media/functions-view-before-fix.png" alt-text="Screenshot of the Build Insights Functions view file.":::
6767
In the Function Name column, performPhysicsCalculations() is highlighted and marked with a fire icon.
@@ -83,7 +83,7 @@ In this example, the `performPhysicsCalculations` function is taking the most ti
8383
In the Function Name column, performPhysicsCalculations() is highlighted and marked with a fire icon.
8484
:::image-end:::
8585

86-
Investigating further, by selecting the chevron before that function, and then sorting the **Forceinline Size** column from highest to lowest, we see the biggest contributors to the problem.
86+
By selecting the chevron before that function, and then sorting the **Forceinline Size** column from highest to lowest, we see the biggest contributors to the problem.
8787

8888
:::image type="complex" source="./media/functions-view-expanded.png" alt-text="Screenshot of the Build Insights Functions view with an expanded function.":::
8989
performPhysicsCalculations() is expanded and shows a long list of functions that were inlined inside it. There are multiple instances of functions such as complexOperation(), recursiveHelper(), and sin() shown. The Forceinline Size column shows that complexOperation() is the largest inlined function at 315 instructions. recursiveHelper() has 119 instructions. Sin() has 75 instructions, but there are many more instances of it than the other functions.
@@ -106,7 +106,7 @@ static __forceinline T factorial(int n)
106106
}
107107
```
108108
109-
Perhaps the overall cost of calling this function is insignificant compared to the cost of the function itself. Making a function inline is most beneficial when the time it takes to call the function (pushing arguments on the stack, jumping to the function, popping return arguments, and returning from the function) is roughly similar to the time it takes to execute the function, and when the function is called a lot. When that's not the case, there may be diminishing returns on making it inline. We can try removing the `__forceinline` directive from it to see if it helps the build time. The code for `power`, `sin()` and `cos()` is similar in that the code consists of a loop that will execute many times. We can try removing the `__forceinline` directive from those functions as well.
109+
Perhaps the overall cost of calling this function is insignificant compared to the cost of the function itself. Making a function inline is most beneficial when the time it takes to call the function (pushing arguments on the stack, jumping to the function, popping return arguments, and returning from the function) is roughly similar to the time it takes to execute the function, and when the function is called a lot. When that's not the case, there may be diminishing returns on making it inline. We can try removing the `__forceinline` directive from it to see if it helps the build time. The code for `power`, `sin()`, and `cos()` is similar in that the code consists of a loop that executes many times. We can try removing the `__forceinline` directive from those functions as well.
110110
111111
We rerun Build Insights from the main menu by choosing **Build** > **Run Build Insights on Selection** > **Rebuild**. You can also right-click a project in the solution explorer and choose **Run Build Insights** > **Rebuild**. We choose **Rebuild** instead of **Build** to measure the build time for the entire project, as before, and not for just the few files may be dirty right now.
112112

docs/build-insights/tutorials/build-insights-template-view.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The **Templates** view works like the Build Insights [Functions view](build-insi
1515
## Prerequisites
1616

1717
- Visual Studio 2022 version 17.10 or later.
18-
- The **C++ Build Insights** component must be installed. It's included in either the Desktop development with C++ workload or the Game development with C++ workload. To check if it's installed, follow these steps:
18+
- The **C++ Build Insights** component must be installed. Either the Desktop development with C++ workload or the Game development with C++ workload includes it. To check if it's installed, follow these steps:
1919
1. Open the Visual Studio Installer.
2020
1. Select **Modify** to change your Visual Studio installation.
2121
1. On the **Individual components** tab, search for and select **C++ Build Insights**, then select **Close** to finish installing the component.
@@ -136,7 +136,7 @@ The Templates view shows two template instantiations of struct S3 taking most (7
136136

137137
### Understanding Templates view results
138138

139-
When interpreting Templates view results, keep this in mind:
139+
When interpreting Templates view results, consider the following:
140140

141141
- **Empty view**: If nothing shows up in the **Templates** view, template instantiations don't dominate your build time. That's good news because your templates aren't a build bottleneck.
142142
- **Duplicate instantiations**: If the same template instantiation appears multiple times across different translation units, different source files are causing the same expensive instantiation. This is often the biggest optimization opportunity.

0 commit comments

Comments
 (0)