Performance Intermediate

Use Claude Code with Chrome DevTools MCP to analyze and optimize web application performance. Record performance traces, run Lighthouse audits, take memory snapshots, identify bottlenecks, and get AI-powered optimization recommendations.

1. Performance Tracing

Record what the browser is doing during a specific interaction to identify performance bottlenecks:

Claude Code Session
# Start a performance trace
Claude > Start a performance trace on the current page

# Perform the action you want to measure
Claude > Click the "Load Dashboard" button

# Stop the trace and analyze
Claude > Stop the performance trace and analyze the results.
         What are the main bottlenecks?
Workflow: Start trace, perform the slow action, stop trace, analyze. This pattern captures exactly the performance data you need without noise from other page activity.

2. Performance Analysis Insights

The performance_analyze_insight tool provides AI-powered analysis of performance data:

Claude Code Session
Claude > Analyze the performance of this page. Tell me:
         1. What is the largest contentful paint (LCP) time?
         2. Are there any long tasks blocking the main thread?
         3. What JavaScript is taking the most time?
         4. Are there any layout shifts?

# Claude uses performance_analyze_insight to provide
# detailed insights with specific recommendations

3. Lighthouse Audits

Run comprehensive Lighthouse audits directly from Claude Code:

Claude Code Session
# Run a full Lighthouse audit
Claude > Run a Lighthouse audit on this page and summarize
         the scores for performance, accessibility, best
         practices, and SEO.

# Focus on specific categories
Claude > Run a Lighthouse performance audit and tell me
         the specific issues that are hurting the score.
         What should I fix first?

Lighthouse provides scores across four categories:

Category What It Measures Key Metrics
Performance Page load speed and responsiveness FCP, LCP, TBT, CLS, Speed Index
Accessibility Usability for all users Color contrast, ARIA labels, keyboard navigation
Best Practices Web development standards HTTPS, image aspect ratios, console errors
SEO Search engine optimization Meta tags, structured data, mobile-friendliness

4. Memory Snapshots

Detect memory leaks by taking heap snapshots at different points:

Claude Code Session
# Take a baseline memory snapshot
Claude > Take a memory snapshot of the current page.
         How much memory is being used?

# Perform the suspected leaky action
Claude > Navigate to /dashboard, then back to /home, and
         repeat this 5 times. Then take another memory snapshot.

# Compare
Claude > Compare the memory usage before and after. Is memory
         growing? What objects are accumulating?

5. Identifying Bottlenecks

Common performance bottlenecks and how to detect them with Claude Code:

Claude Code Session
# Check for render-blocking resources
Claude > Run JavaScript to find all render-blocking scripts
         and stylesheets in the document head

# Check image optimization
Claude > List all images on the page with their file sizes
         and dimensions. Are any images significantly larger
         than their display size?

# Check for unused JavaScript
Claude > Run a Lighthouse audit and tell me how much unused
         JavaScript is on this page

6. Optimization Recommendations

After identifying issues, Claude Code can suggest specific optimizations:

Claude Code Session
Claude > Based on the Lighthouse audit results, create a
         prioritized list of performance improvements I should
         make. For each item, estimate the impact on the
         performance score and the effort required to fix it.

7. Before/After Comparisons

Claude Code Session
# Measure before optimization
Claude > Run a Lighthouse performance audit and save the scores.

# ... make your optimizations ...

# Measure after optimization
Claude > Run the Lighthouse performance audit again. Compare
         the scores with the previous run. Which metrics improved?

Practice Performance Analysis

Navigate to a web page, run a Lighthouse audit, and use Claude Code to interpret the results and suggest improvements. Then try recording a performance trace during a specific interaction.

Next: Network Analysis →

Ready to Go Deeper?

Live instructor-led courses from our partners. Affiliate disclosure.