aj-geddes avatar

Profiling Optimization

This one walks you through finding performance bottlenecks using CPU profiling, flame graphs, and benchmarking across multiple languages. You get working examples for Node.js perf_hooks, Chrome DevTools profiling, Python's cProfile, and database query analysis. The approach is sensible: profile first, focus on hot paths, measure everything. What I like is it includes both the instrumentation code and the tooling to actually visualize what's slow, not just raw timing data. The best practices are refreshingly pragmatic about not optimizing cold paths or sacrificing readability for negligible gains. Solid reference if you're investigating slow requests or need to justify optimization work with real data instead of hunches.

skills.sh installs
456
GitHub stars
379
last updated
Aug 21, 2026

Install

$ npx -y skills add aj-geddes/useful-ai-prompts --skill profiling-optimization --agent claude-code

Installs into .claude/skills of the current project.

Files

Profiling & Optimization

Table of Contents

Overview

Profile code execution to identify performance bottlenecks and optimize critical paths using data-driven approaches.

When to Use

  • Performance optimization
  • Identifying CPU bottlenecks
  • Optimizing hot paths
  • Investigating slow requests
  • Reducing latency
  • Improving throughput

Quick Start

Minimal working example:

import { performance, PerformanceObserver } from "perf_hooks";

class Profiler {
  private marks = new Map<string, number>();

  mark(name: string): void {
    this.marks.set(name, performance.now());
  }

  measure(name: string, startMark: string): number {
    const start = this.marks.get(startMark);
    if (!start) throw new Error(`Mark ${startMark} not found`);

    const duration = performance.now() - start;
    console.log(`${name}: ${duration.toFixed(2)}ms`);

    return duration;
  }

  async profile<T>(name: string, fn: () => Promise<T>): Promise<T> {
    const start = performance.now();

Sponsors

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Categories
AI & Agent Building, Debugging
First seen
Jun 3, 2026

More from aj-geddes/useful-ai-prompts

All 258
1automattic avatarwordpress-routerautomattic/agent-skillswordpress router456skills.sh installs
2aj-geddes avatarcpu-profilingaj-geddes/useful-ai-promptsProfile CPU usage to identify hot spots and bottlenecks. Optimize code paths consuming most CPU time for better performance and resource efficiency.455skills.sh installs
3aj-geddes avatarsecurity-documentationaj-geddes/useful-ai-promptsCreate security policies, guidelines, compliance documentation, and security best practices. Use when documenting security policies, compliance requirements, or455skills.sh installs
4sugarforever avatarpublish-x-articlesugarforever/01coder-agent-skillsPublish Markdown articles to X (Twitter) Articles editor with proper formatting. Use when user wants to publish a Markdown file/URL to X Articles, or mentions "455skills.sh installs
5aj-geddes avatarfrontend-routingaj-geddes/useful-ai-promptsImplement client-side routing using React Router, Vue Router, and Angular Router. Use when building multi-page applications with navigation and route protection454skills.sh installs
6aj-geddes avatarload-balancer-setupaj-geddes/useful-ai-promptsConfigure and deploy load balancers (HAProxy, AWS ELB/ALB/NLB) for distributing traffic, session management, and high availability.454skills.sh installs