CC-301f · Module 3

Performance Debugging

3 min read

Performance bugs are Tier 3 problems — the code runs correctly but too slowly. Claude cannot profile your application, but it can analyze profiler output. The workflow: run your profiler (Chrome DevTools, Node --prof, py-spy), export the results as text, and feed them to Claude. "Here is the CPU profile for a slow API endpoint. Identify the hotspots — functions consuming more than 10% of total time — and suggest optimizations."

Claude is particularly effective at identifying algorithmic inefficiencies in source code. "This endpoint takes 3 seconds for 1000 records. Read the implementation and identify any O(n^2) or worse operations." Claude scans the code, finds the nested loop or repeated database query, and proposes the fix — usually a lookup table, a batch query, or a caching layer. These are the performance wins that profilers point to but developers still need to interpret.

Do This

  • Run the profiler yourself and feed the output to Claude for analysis
  • Ask Claude to identify algorithmic inefficiencies in source code
  • Specify the performance target: "This must complete in under 200ms"
  • Have Claude suggest caching, batching, or indexing before algorithmic changes

Avoid This

  • Ask Claude to "make this faster" without profiling data
  • Optimize code that has not been measured — you might optimize the wrong thing
  • Let Claude add caching without understanding the invalidation requirements
  • Micro-optimize before fixing algorithmic issues — fix O(n^2) before optimizing O(n)