Supercharged profiling: Finding performance bugs with agents | DEM300
Nik Karpinsky demonstrates how to diagnose and fix modern performance issues using Visual Studio’s profiling and diagnostics tools, with GitHub Copilot and AI-powered agents helping generate, refine, and explain benchmark and profiling results for faster root-cause analysis.
Overview
Modern performance problems can be difficult to diagnose due to factors like distributed systems, async code, and large volumes of data. This Build 2026 demo session focuses on using Visual Studio’s profiler and diagnostics experience together with AI-powered assistance (including agent-style workflows) to:
- Surface bottlenecks more quickly
- Explain likely root causes
- Guide developers toward fixes
- Validate whether changes actually improved performance
What the session covers
Using Visual Studio Profiler to identify performance issues
- Demonstrates profiling workflows in Visual Studio aimed at finding CPU and memory bottlenecks.
- Emphasizes scenarios where issues are hard to reproduce locally (including problems that only show up in production).
Creating benchmarks for accurate performance testing
- Shows how to create benchmarks to measure performance changes reliably.
- Uses a benchmark-driven approach to avoid “it feels faster” optimization and to quantify impact.
Working with a sample repo in Visual Studio
- Clones a repository and opens the solution in Visual Studio.
- Walks through setting up a controlled test scenario to isolate a specific performance concern.
Isolating enumeration performance with an in-memory CSV setup
- Uses an in-memory CSV approach to reduce external variables and focus on enumeration performance.
- Frames the setup as a way to make profiling and benchmarking results more trustworthy.
Reviewing and refining Copilot-generated benchmark code
- Uses GitHub Copilot to help generate benchmark code.
- Reviews and refines the generated code rather than accepting it blindly, focusing on correctness and measurement quality.
Capturing and analyzing profiling traces
- Captures a profiling trace and loads it into Visual Studio for analysis.
- Uses the trace to identify bottlenecks and understand where time and memory are being spent.
Measuring impact and continuing optimization
- Re-runs benchmarks after changes to validate improvements.
- Notes that some changes may yield only marginal gains, reinforcing the need for measurement and iterative optimization.
Copilot as a learning tool
- Positions Copilot as a way for engineers to learn while working through performance investigations (e.g., understanding why a bottleneck occurs and what changes might help).