performance-optimization

Use when code is slow, resource-heavy, or needs optimization — before making any changes, after profiling reveals bottlenecks, or when designing performance-sensitive systems

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "performance-optimization" with this command: npx skills add derhaken/superantigravity/derhaken-superantigravity-performance-optimization

Performance Optimization

Overview

Measure first, optimize second. Never optimize without data. The bottleneck is almost never where you think it is.

When to Use

  • Code is measurably slow or resource-heavy
  • Profiling has revealed specific bottlenecks
  • Designing a system with known performance requirements
  • Reviewing code for performance before production

When NOT to Use

  • You "feel like" code might be slow but haven't measured
  • Premature optimization during initial implementation
  • Micro-optimizations that don't move the needle

The Process

1. Measure baseline Before touching anything, establish a benchmark.

  • Record current performance numbers (time, memory, CPU)
  • Document the test conditions (data size, concurrency, hardware)
  • Save results as your baseline

2. Profile to find the bottleneck Use profiling tools appropriate to your stack:

  • Python: cProfile, py-spy, memory_profiler
  • Node.js: --prof, clinic.js, Chrome DevTools
  • Go: pprof
  • Generic: timing instrumentation, APM tools

The bottleneck is the one place where optimization actually matters.

3. Form hypothesis State explicitly: "I believe X is slow because Y." Don't optimize something you can't explain.

4. Apply targeted fix Change ONE thing at a time. Common high-impact areas:

  • Database: N+1 queries, missing indexes, over-fetching
  • Network: unnecessary round trips, large payloads, no caching
  • Memory: leaks, excessive allocation, large objects in hot paths
  • Algorithms: O(n²) where O(n log n) is possible
  • I/O: synchronous blocking, missing batching

5. Measure again Compare to baseline. Did it improve? If not, revert and try something else.

6. Document the change Record what you changed, why, and the before/after numbers.

Common High-Impact Wins

AreaLook For
DatabaseN+1 queries, full table scans, missing indexes
CachingRepeated expensive computations with same inputs
NetworkChatty APIs, large payloads, synchronous chains
AlgorithmsNested loops over large collections
MemoryObjects created in tight loops, large in-memory datasets

Red Flags

ThoughtReality
"This looks slow"Measure it. Looks are deceiving.
"I'll optimize as I go"Premature optimization obscures intent. Measure first.
"I fixed the bottleneck"Did you measure? Fix without measurement isn't a fix.
"This is the obvious bottleneck"Profile anyway. You're probably wrong.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

subagent-driven-development

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

finishing-a-development-branch

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

requesting-code-review

No summary provided by upstream source.

Repository SourceNeeds Review