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: Instructions/Labs/LAB_AK_10_implement_performance_profiling.md
+15-13Lines changed: 15 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,7 +107,7 @@ Use the following steps to download the sample project and open it in Visual Stu
107
107
108
108
You're a software developer working fora consulting firm. Your clients need help implementing performance profilingin legacy applications. Your goal is to improve code performance while preserving readability and the existing functionality. You're assigned to the following app:
109
109
110
-
- ContosoOnlineStore: This is a comprehensive e-commerce application that processes customer orders with realistic business complexity. The application includes product catalog management with search capabilities, inventory tracking with stock reservations, order processing with validation and receipts, email notification services, and security validation. The application uses modern .NET architecture patterns including dependency injection, structured logging, and configuration management, but contains intentional performance bottlenecks that mirror real-world scenarios.
110
+
- ContosoOnlineStore: This is an e-commerce application that processes customer orders with realistic business complexity. The application includes product catalog management with search capabilities, inventory tracking with stock reservations, order processing with validation and receipts, email notification services, and security validation. The application uses modern .NET architecture patterns including dependency injection, structured logging, and configuration management, but contains performance bottlenecks that mirror real-world scenarios.
111
111
112
112
This exercise includes the following tasks:
113
113
@@ -124,7 +124,7 @@ In this task, you'll examine the main components of the ContosoOnlineStore proje
124
124
125
125
Use the following steps to complete this task:
126
126
127
-
1. Take a minute to review the ContosoOnlineStore project structure.
127
+
1. Take a few minutes to review the ContosoOnlineStore project structure.
128
128
129
129
The codebase follows modern .NET architecture patterns with clear separation of concerns. The main architectural components include:
130
130
@@ -150,7 +150,7 @@ Use the following steps to complete this task:
150
150
151
151
1. Run the application and observe the baseline performance.
152
152
153
-
You can run the application from the Visual Studio Code integrated terminal by navigating to the project folder and running:
153
+
You can run the application from the Visual Studio Code integrated terminal by navigating to the project folder and running the following .NET CLI command:
154
154
155
155
```bash
156
156
dotnet run
@@ -164,7 +164,9 @@ Use the following steps to complete this task:
164
164
- Concurrent operation testing
165
165
- Email notification simulation
166
166
167
-
1. Record the baseline performance metrics.
167
+
1. Store the baseline performance metrics in a file named **baseline_metrics.txt**.
168
+
169
+
Create a text file named baseline_metrics.txt. Copy the console output into the baseline_metrics.txt file.
168
170
169
171
Pay attention to the timing information displayed in the console output, such as:
170
172
@@ -176,12 +178,12 @@ Use the following steps to complete this task:
176
178
177
179
The application also runs a comprehensive performance analysis suite that tests various operations and reports timing details.
178
180
179
-
1. Examine the performance benchmark capabilities.
181
+
1. Take a minute to examine the performance benchmark capabilities provided by the OrderProcessingBenchmarks.cs file.
180
182
181
183
The application includes professional benchmarking using BenchmarkDotNet. You can run detailed performance benchmarks by executing:
182
184
183
185
```bash
184
-
dotnet run benchmark
186
+
dotnet run -c Release -- benchmark
185
187
```
186
188
187
189
This will generate detailed performance reports including memory allocation patterns and statistical analysis.
@@ -202,19 +204,19 @@ Use the following steps to complete this task:
202
204
203
205
>**NOTE**: The GPT-4o model provides excellent code analysis capabilities and is recommended for this performance analysis task.
204
206
205
-
1. Close any files that aren't directly related to the performance analysis.
207
+
1. Close any files that you have open in the editor.
206
208
207
209
GitHub Copilot uses files that are open in the editor to establish context. Having only the target files open helps focus the analysis on the code you want to optimize.
208
210
209
-
1. Add the main business logic files to the Chat context.
211
+
1. Add the **ProductCatalog.cs**, **OrderProcessor.cs**, and **InventoryManager.cs** files to the Chat context.
210
212
211
213
Use a drag-and-drop operation to add **ProductCatalog.cs**, **OrderProcessor.cs**, and **InventoryManager.cs** from the SOLUTION EXPLORER to the Chat context.
212
214
213
215
Adding files to the chat context tells GitHub Copilot to include those files when analyzing your prompts, which improves the accuracy and relevance of its analysis.
214
216
215
217
1. Ask GitHub Copilot to identify performance bottlenecks in the ProductCatalog class.
216
218
217
-
Enter the following prompt in the Chat view:
219
+
For example, enter the following prompt in the Chat view:
218
220
219
221
```text
220
222
Analyze the ProductCatalog class for performance bottlenecks. Focus on the GetProductById, SearchProducts, and GetProductsByCategory methods. What are the main inefficiencies and how could they be optimized?
@@ -229,7 +231,7 @@ Use the following steps to complete this task:
229
231
230
232
1. Ask GitHub Copilot to analyze the OrderProcessor performance issues.
231
233
232
-
Submit the following prompt:
234
+
For example, submit the following prompt:
233
235
234
236
```text
235
237
Examine the OrderProcessor class, particularly the CalculateOrderTotal and FinalizeOrderAsync methods. What performance problems do you see and what optimization strategies would you recommend?
@@ -244,7 +246,7 @@ Use the following steps to complete this task:
244
246
245
247
1. Analyze the InventoryManager for efficiency issues.
246
248
247
-
Use this prompt to examine inventory operations:
249
+
For example, use this prompt to examine inventory operations:
248
250
249
251
```text
250
252
Review the InventoryManager class, especially the GetLowStockProducts and UpdateStockLevels methods. What are the performance concerns and how could the inventory operations be improved?
@@ -259,7 +261,7 @@ Use the following steps to complete this task:
259
261
260
262
1. Ask about the EmailService performance characteristics.
261
263
262
-
Submit this prompt to analyze the email service:
264
+
For example, submit this prompt to analyze the email service:
263
265
264
266
```text
265
267
Analyze the EmailService class for performance issues. How does the email sending process impact overall application performance and what improvements could be made?
@@ -408,7 +410,7 @@ Use the following steps to complete this task:
408
410
Run the detailed performance benchmarks to get precise measurements:
409
411
410
412
```bash
411
-
dotnet run benchmark
413
+
dotnet run -c Release -- benchmark
412
414
```
413
415
414
416
Review the BenchmarkDotNet reports, which provide detailed statistics including:
0 commit comments