Skip to content

Commit 55acdad

Browse files
authored
Trim all trailing spaces in "Troubleshoot template instantiation impact on build time" topic
1 parent 7e272e0 commit 55acdad

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

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

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The **Templates** view works like the Build Insights [Functions view](build-insi
2121
1. Select **Modify** to change your Visual Studio installation.
2222
1. On the **Individual components** tab, search for and select **C++ Build Insights**, then select **Close** to finish installing the component.
2323
:::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+
2525
## Overview
2626

2727
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,55 @@ In this article, you create a project that shows how template instantiation affe
3636
1. Create a header file named `Templates.h`, then replace its contents with the following code:
3737

3838
```cpp
39-
#pragma once
40-
#include <utility>
41-
#include <vector>
42-
43-
template<size_t> struct S1 {};
44-
template<int n> using type = std::vector<S1<n>>;
45-
46-
template<size_t...> struct S2 {};
47-
48-
template<typename> struct S3 {};
49-
50-
template<size_t... n>
39+
#pragma once
40+
#include <utility>
41+
#include <vector>
42+
43+
template<size_t> struct S1 {};
44+
template<int n> using type = std::vector<S1<n>>;
45+
46+
template<size_t...> struct S2 {};
47+
48+
template<typename> struct S3 {};
49+
50+
template<size_t... n>
5151
struct S3<std::index_sequence<n...>>
52-
{
53-
using type = S2<sizeof(type<n>)...>;
54-
};
55-
52+
{
53+
using type = S2<sizeof(type<n>)...>;
54+
};
55+
5656
inline size_t LargeValue()
57-
{
58-
return sizeof(S3<std::make_index_sequence<1000>>);
59-
};
60-
57+
{
58+
return sizeof(S3<std::make_index_sequence<1000>>);
59+
};
60+
6161
inline size_t SmallValue()
62-
{
63-
return sizeof(S1<5>);
64-
}
62+
{
63+
return sizeof(S1<5>);
64+
}
6565
```
6666

6767
1. Create a source file named `LargeValue.cpp`, then replace its contents with the following code:
6868

6969
```cpp
70-
#include "Templates.h"
70+
#include "Templates.h"
7171

7272
size_t GetLargeValue()
73-
{
74-
return LargeValue();
75-
}
73+
{
74+
return LargeValue();
75+
}
7676
```
7777

7878
1. Replace the contents of the `TemplateAnalysis.cpp` file with the following code:
7979

8080
```cpp
81-
#include "Templates.h"
81+
#include "Templates.h"
8282

8383
extern size_t GetLargeValue();
8484

8585
size_t GetSmallValue()
86-
{
87-
return SmallValue();
86+
{
87+
return SmallValue();
8888
}
8989

9090
int main()
@@ -107,7 +107,7 @@ Template instantiation time collection is off by default to minimize build overh
107107

108108
:::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.":::
109109

110-
> [!Note]
110+
> [!Note]
111111
> Collecting template instantiation times increases build time due to the extra data collected. Only enable it when you want to analyze template instantiation bottlenecks.
112112
113113
## Run Build Insights to get template instantiation data

0 commit comments

Comments
 (0)