Skip to content

Commit 1ef0c03

Browse files
committed
Lab 10 instructions update
1 parent 8b6863f commit 1ef0c03

1 file changed

Lines changed: 42 additions & 40 deletions

File tree

Instructions/Labs/LAB_AK_10_implement_performance_profiling.md

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,13 @@ Use the following steps to complete this task:
208208

209209
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.
210210

211-
1. Add the **ProductCatalog.cs**, **OrderProcessor.cs**, and **InventoryManager.cs** files to the Chat context.
211+
1. Add the **InventoryManager.cs**, **OrderProcessor.cs**, and **ProductCatalog.cs** files to the Chat context.
212212

213-
Use a drag-and-drop operation to add **ProductCatalog.cs**, **OrderProcessor.cs**, and **InventoryManager.cs** from the SOLUTION EXPLORER to the Chat context.
213+
Use a drag-and-drop operation to add **InventoryManager.cs**, **OrderProcessor.cs**, and **ProductCatalog.cs** from the SOLUTION EXPLORER to the Chat context.
214214

215215
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.
216216

217-
1. Ask GitHub Copilot to identify performance bottlenecks in the ProductCatalog class.
217+
1. Ask GitHub Copilot to identify performance bottlenecks in the ProductCatalog class and suggest optimizations.
218218

219219
For example, enter the following prompt in the Chat view:
220220

@@ -224,12 +224,12 @@ Use the following steps to complete this task:
224224

225225
Review GitHub Copilot's analysis, which should identify issues such as:
226226
227-
- Linear search performance in GetProductById for certain conditions
228-
- Inefficient cache key generation in SearchProducts
229-
- Sequential processing with artificial delays
230-
- Missing optimized data structures for category filtering
227+
- Linear search performance in GetProductById for certain conditions.
228+
- Inefficient cache key generation in SearchProducts.
229+
- Missing optimized data structures for category filtering in GetProductsByCategory.
230+
- Sequential processing with artificial delays in several of the methods.
231231
232-
1. Ask GitHub Copilot to analyze the OrderProcessor performance issues.
232+
1. Ask GitHub Copilot to identify performance issues in the OrderProcessor class and suggest optimizations.
233233
234234
For example, submit the following prompt:
235235
@@ -239,12 +239,12 @@ Use the following steps to complete this task:
239239
240240
GitHub Copilot should identify problems including:
241241
242-
- Individual product lookups in loops (N+1 query pattern)
243-
- Redundant tax and shipping calculations
244-
- Sequential processing of order items
245-
- Blocking operations that could be made asynchronous
242+
- Individual product lookups in loops (N+1 query pattern).
243+
- Redundant tax and shipping calculations.
244+
- Sequential processing of order items.
245+
- Blocking operations that could be made asynchronous.
246246
247-
1. Analyze the InventoryManager for efficiency issues.
247+
1. Ask GitHub Copilot to identify performance issues in the InventoryManager class and suggest optimizations.
248248
249249
For example, use this prompt to examine inventory operations:
250250
@@ -254,12 +254,12 @@ Use the following steps to complete this task:
254254
255255
The analysis should reveal:
256256
257-
- Individual database query simulation in loops
258-
- Inefficient logging implementation with blocking operations
259-
- Missing batch operation support
260-
- Unnecessary thread delays in stock level checks
257+
- Individual database query simulation in loops.
258+
- Inefficient logging implementation with blocking operations.
259+
- Missing batch operation support.
260+
- Unnecessary thread delays in stock level checks.
261261
262-
1. Ask about the EmailService performance characteristics.
262+
1. Ask GitHub Copilot to identify performance issues in the EmailService class and suggest optimizations.
263263
264264
For example, submit this prompt to analyze the email service:
265265
@@ -269,16 +269,18 @@ Use the following steps to complete this task:
269269
270270
GitHub Copilot should identify:
271271
272-
- Sequential email content generation with blocking operations
273-
- Individual product lookups within email templates
274-
- Synchronous validation operations
275-
- Missing parallelization opportunities for multiple recipients
272+
- Sequential email content generation with blocking operations.
273+
- Individual product lookups within email templates.
274+
- Synchronous validation operations.
275+
- Missing parallelization opportunities for multiple recipients.
276276
277277
By using GitHub Copilot's analytical capabilities, you've identified the main performance bottlenecks in the ContosoOnlineStore application. The analysis provides a roadmap for optimization efforts, focusing on algorithmic improvements, caching strategies, and asynchronous processing patterns.
278278
279279
### Refactor performance-critical code using GitHub Copilot Chat (Agent mode)
280280
281-
GitHub Copilot Chat's Agent mode enables collaborative code refactoring where you can request specific code changes and improvements. In Agent mode, Copilot can generate optimized code implementations, suggest architectural improvements, and help implement performance enhancements.
281+
GitHub Copilot's Agent mode provides an autonomous agent that assists with programming tasks. Developers assign high-level tasks and then start an agentic code editing session to accomplish the task. In agent mode, Copilot autonomously plans the work needed and determines the relevant files and context. The agent can make changes to your code, run tests, and even deploy your application.
282+
283+
In Agent mode, GitHub Copilot can generate optimized code implementations, suggest architectural improvements, and help implement performance enhancements.
282284

283285
In this task, you'll use GitHub Copilot Agent mode to systematically address the performance bottlenecks identified in the previous task.
284286
@@ -288,51 +290,51 @@ Use the following steps to complete this task:
288290
289291
In the Chat view, change the mode from **Ask** to **Agent**. Agent mode provides more targeted code generation and modification capabilities.
290292
291-
1. Optimize the ProductCatalog GetProductById method.
293+
1. Assign a task to the agent that optimizes the GetProductById method in the ProductCatalog class.
292294
293-
Open **ProductCatalog.cs** and select the `GetProductById` method. Use the following prompt in Chat:
295+
Open **ProductCatalog.cs** and select the **GetProductById** method. Use the following prompt in Chat:
294296
295297
```text
296298
Optimize this GetProductById method to improve performance. Consider using a dictionary lookup instead of linear search and implement proper caching mechanisms.
297299
```
298300
299301
Review GitHub Copilot's suggested improvements and implement the changes. The optimized version should include:
300302

301-
- Dictionary-based product lookups for O(1) performance
302-
- Proper cache initialization and management
303-
- Reduced redundant operations
303+
- Dictionary-based product lookups for O(1) performance.
304+
- Proper cache initialization and management.
305+
- Reduced redundant operations.
304306

305-
1. Enhance the SearchProducts method efficiency.
307+
1. Assign a task to the agent that enhances the efficiency of the SearchProducts method.
306308

307-
Select the `SearchProducts` method in **ProductCatalog.cs** and use this prompt:
309+
Select the **SearchProducts** method in **ProductCatalog.cs** and use this prompt:
308310

309311
```text
310312
Refactor the SearchProducts method to eliminate performance bottlenecks. Optimize the search algorithm and remove unnecessary delays while maintaining search functionality.
311313
```
312314
313315
Apply GitHub Copilot's suggestions to implement:
314316
315-
- Efficient string matching algorithms
316-
- Parallel processing for multiple search criteria
317-
- Optimized cache key generation
317+
- Efficient string matching algorithms.
318+
- Parallel processing for multiple search criteria.
319+
- Optimized cache key generation.
318320
319-
1. Improve OrderProcessor performance for order calculations.
321+
1. Assign a task to the agent that improves the performance of the CalculateOrderTotal method in the OrderProcessor class.
320322
321-
Open **OrderProcessor.cs** and select the `CalculateOrderTotal` method. Submit this prompt:
323+
Open **OrderProcessor.cs** and select the **CalculateOrderTotal** method. Submit this prompt:
322324
323325
```text
324326
Optimize the CalculateOrderTotal method to reduce redundant product lookups and improve calculation performance. Consider batch operations and caching strategies.
325327
```
326328
327329
Implement the suggested improvements, which should include:
328330
329-
- Batch product retrieval to eliminate N+1 query patterns
330-
- Cached product information during order processing
331-
- Optimized tax and shipping calculations
331+
- Batch product retrieval to eliminate N+1 query patterns.
332+
- Cached product information during order processing.
333+
- Optimized tax and shipping calculations.
332334
333335
1. Optimize the FinalizeOrderAsync method.
334336
335-
Select the `FinalizeOrderAsync` method in **OrderProcessor.cs** and use this prompt:
337+
Select the **FinalizeOrderAsync** method in **OrderProcessor.cs** and use this prompt:
336338
337339
```text
338340
Refactor the FinalizeOrderAsync method to improve async performance. Focus on parallel processing where possible and optimizing await patterns.
@@ -346,7 +348,7 @@ Use the following steps to complete this task:
346348
347349
1. Enhance InventoryManager batch operations.
348350
349-
Open **InventoryManager.cs** and select the `UpdateStockLevels` method. Use this prompt:
351+
Open **InventoryManager.cs** and select the **UpdateStockLevels** method. Use this prompt:
350352
351353
```text
352354
Optimize the UpdateStockLevels method to support batch operations and reduce individual update overhead. Implement efficient logging and remove unnecessary delays.

0 commit comments

Comments
 (0)