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/profiling/optimize-code-using-profiling-tools.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ monikerRange: '>= vs-2022'
16
16
---
17
17
# Beginner's guide to optimizing code and reducing compute costs (C#, Visual Basic, C++, F#)
18
18
19
-
In this guide, we aim to provide a comprehensive understanding of how to optimize code to reduce compute costs effectively and save money. By leveraging Visual Studio's profiling tools, developers can gain insights into their application's performance, identify bottlenecks, and implement optimizations to improve efficiency.
19
+
Reducing your compute time means reducing costs, so optimizing your code can save money. In this case study, we show how you can use profiling tools to help you accomplish this task.
20
20
21
21
Our goal is to equip developers with the knowledge to:
22
22
@@ -57,11 +57,12 @@ Addressing these challenges requires a strategic approach that combines effectiv
57
57
58
58
## Strategy
59
59
60
-
- We start the investigation by taking a CPU usage trace. The CPU Usage tool is often helpful to begin performance investigations and to optimize code to reduce cost.
61
-
The CPU Usage views such as the call tree and flame graph provide a nice graphical visualization of where time is spent in the app. In addition, auto insights may show precise optimizations that can have a large impact.
60
+
Here is a high-level view of the approach:
61
+
62
+
- We start the investigation by taking a CPU usage trace. Visual Studio's [CPU Usage tool](../profiling/cpu-usage.md) is often helpful to begin performance investigations and to optimize code to reduce cost.
62
63
- Next, to get additional insights to help isolate issues or improve the performance, we collect a trace using one of the other profiling tools. For example:
63
-
- We take a look at the memory usage. For .NET, we try the .NET Object Allocation tool first. (For either .NET or C++, you can look at the Memory Usage tool instead.)
64
-
- For ADO.NET or Entity Framework, we can use the Database tool to examine SQL queries, precise query time, et al.
64
+
- We take a look at the memory usage. For .NET, we try the [.NET Object Allocation tool](../profiling/dotnet-alloc-tool.md) first. (For either .NET or C++, you can look at the Memory Usage tool instead.)
65
+
- For ADO.NET or Entity Framework, we can use the [Database tool](../profiling/analyze-database.md) to examine SQL queries, precise query time, and more.
65
66
66
67
Data collection requires the following steps:
67
68
@@ -71,7 +72,7 @@ Data collection requires the following steps:
71
72
72
73
### Inspect areas of high CPU usage
73
74
74
-
We start by collecting a trace with the CPU Usage tool. When the diagnostic data loads, we first check the initial *.diagsession* report page that shows Top Insights and the Hot Path. The Hot Path shows the code path with highest CPU usage in the app. These sections may provide tips to help us quickly identify performance issues that we can improve.
75
+
After collecting a trace with the CPU Usage tool and loading it into Visual Studio, we first check the initial *.diagsession* report page that shows Top Insights and the Hot Path. The Hot Path shows the code path with highest CPU usage in the app. These sections may provide tips to help us quickly identify performance issues that we can improve.
75
76
76
77
We can also view the hot path in the **Call Tree** view. To open this view, use the **Open details** link in the report and then select **Call Tree**.
0 commit comments