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
Copy file name to clipboardExpand all lines: docs/build-insights/tutorials/build-insights-template-view.md
+37-36Lines changed: 37 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ The **Templates** view works like the Build Insights [Functions view](build-insi
21
21
1. Select **Modify** to change your Visual Studio installation.
22
22
1. On the **Individual components** tab, search for and select **C++ Build Insights**, then select **Close** to finish installing the component.
23
23
:::image type="content" source="./media/installer-build-insights.png" alt-text="Screenshot of the Visual Studio Installer. The search box contains C++ Build Insights. The item C++ Build Insights is visible and selected.":::
24
-
24
+
25
25
## Overview
26
26
27
27
Build Insights, integrated into Visual Studio, helps you optimize your build times--especially for large projects like AAA games. Build Insights provides analytics such as the **Templates** view, which shows the time it takes to instantiate each template and which template instantiations add the most to your build time.
@@ -36,55 +36,56 @@ In this article, you create a project that shows how template instantiation affe
36
36
1. Create a header file named `Templates.h`, then replace its contents with the following code:
1. Create a source file named `LargeValue.cpp`, then replace its contents with the following code:
68
69
69
70
```cpp
70
-
#include"Templates.h"
71
+
#include"Templates.h"
71
72
72
73
size_tGetLargeValue()
73
-
{
74
-
return LargeValue();
75
-
}
74
+
{
75
+
return LargeValue();
76
+
}
76
77
```
77
78
78
79
1. Replace the contents of the `TemplateAnalysis.cpp` file with the following code:
79
80
80
81
```cpp
81
-
#include"Templates.h"
82
+
#include"Templates.h"
82
83
83
84
externsize_tGetLargeValue();
84
85
85
86
size_tGetSmallValue()
86
-
{
87
-
return SmallValue();
87
+
{
88
+
return SmallValue();
88
89
}
89
90
90
91
int main()
@@ -107,7 +108,7 @@ Template instantiation time collection is off by default to minimize build overh
107
108
108
109
:::image type="content" source="./media/tools-options-build-insights.png" alt-text="Screenshot of the project property pages dialog. The settings are open to Build Insights > Trace Collection. The Collect Template Instantiation checkbox is selected.":::
109
110
110
-
> [!Note]
111
+
> [!NOTE]
111
112
> Collecting template instantiation times increases build time due to the extra data collected. Only enable it when you want to analyze template instantiation bottlenecks.
112
113
113
114
## Run Build Insights to get template instantiation data
@@ -128,7 +129,7 @@ The **Templates** view lists the template instantiations that contributed signif
128
129
-**Instantiation File Name** shows where the template is defined.
129
130
130
131
:::image type="complex" source="./media/templates-view-before-fix.png" alt-text="Screenshot of the Build Insights Templates view showing expensive template instantiations." lightbox="./media/templates-view-before-fix.png":::
131
-
The Templates view shows two template instantiations of struct S3 taking most (79.448 percent) of the build time. The Translation Unit column shows that both LargeValue.cpp and SmallValue.cpp are affected. The build time is 4.066 seconds.
132
+
The Templates view shows two template instantiations of struct S3 taking most (79.448 percent) of the build time. The Translation Unit column shows that both LargeValue.cpp and TemplateAnalysis.cpp are affected. The build time is 4.966 seconds.
132
133
:::image-end:::
133
134
134
135
- Sort by **Time** to find the templates that take the longest to instantiate.
@@ -146,7 +147,7 @@ To interpret the **Templates** view results:
146
147
147
148
## Improve build time by optimizing template instantiations
148
149
149
-
In the example, two template instantiations of `S3` take 79 percent of the build time. The **Translation Unit** column shows that both `SmallValue.cpp` and `LargeValue.cpp` cause this template instantiation.
150
+
In the example, two template instantiations of `S3` take 79 percent of the build time. The **Translation Unit** column shows that both `LargeValue.cpp` and `TemplateAnalysis.cpp` cause this template instantiation.
150
151
151
152
The **Instantiation File Name** and the **Specialization Name** are the same for both entries, which means one expensive template instantiation that affects both source files. That's why the time for each of the two template instantiations is roughly equal. Including `Templates.h` in both source files causes one template instantiation to add significant time to the build.
152
153
@@ -156,7 +157,7 @@ From the **Specialization Name** column, the expensive instantiation is `S3<std:
Copy file name to clipboardExpand all lines: docs/c-runtime-library/acmdln-tcmdln-wcmdln.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,13 @@
1
1
---
2
-
description: "Learn more about: _acmdln, _tcmdln, _wcmdln"
3
2
title: "_acmdln, _tcmdln, _wcmdln"
4
-
ms.date: "11/04/2016"
3
+
description: "Learn more about: _acmdln, _tcmdln, _wcmdln"
4
+
ms.date: 11/04/2016
5
5
api_name: ["_wcmdln", "_acmdln"]
6
6
api_location: ["msvcrt.dll"]
7
7
api_type: ["DLLExport"]
8
8
topic_type: ["apiref"]
9
9
f1_keywords: ["_acmdln", "_wcmdln", "_tcmdln"]
10
10
helpviewer_keywords: ["_wcmdln global variable", "wcmdln global variable", "_acmdln global variable", "_tcmdln global variable", "tcmdln global variable", "acmdln global variable"]
11
-
ms.assetid: 4fc0a6a0-3f93-420a-a19f-5276061ba539
12
11
---
13
12
# `_acmdln`, `_tcmdln`, `_wcmdln`
14
13
@@ -24,6 +23,7 @@ wchar_t * _wcmdln;
24
23
#define _tcmdln _wcmdln
25
24
#else
26
25
#define _tcmdln _acmdln
26
+
#endif
27
27
```
28
28
29
29
## Remarks
@@ -32,4 +32,4 @@ These CRT internal variables store the complete command line. They're exposed in
0 commit comments