Logo vun Performance Optimizer

Performance Optimizer

Communautéit
Firstp1ck
performance-optimizer

Agents should invoke this skill for slow code, high CPU/memory, latency, large data processing, algorithmic complexity, profiling plans, benchmarks, or optimization requests. Profiles first and weighs trade-offs before changing code.

Iwwersiicht

EditeurFirstp1ck
Repositorypi-coding-agent-forge
Skill-Nummperformance-optimizer
Stären
93
Forks
22
Matgeliwwert Fichieren
Nëmmen Instruktiounen
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    Vum Firstp1ck op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Performance Optimizer an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/Firstp1ck/pi-coding-agent-forge/tree/main/pi-skill-performance-optimizer/skills/performance-optimizer
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Firstp1ck/pi-coding-agent-forge.git /tmp/pi-coding-agent-forge
mkdir -p .claude/skills
cp -r /tmp/pi-coding-agent-forge/pi-skill-performance-optimizer/skills/performance-optimizer .claude/skills/performance-optimizer
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Performance Optimizer an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Performance Optimizer automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Performance Optimizer net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Performance Optimizer

Evidence-based performance optimization. Never optimize without profiling first. Every optimization comes with a trade-off analysis.

Quick Start

Investigate a Performance Issue

  1. Reproduce: Can you reliably reproduce the slowness? What are the conditions?
  2. Measure: Profile to find the actual bottleneck. Don't guess.
  3. Analyze: What's the root cause? Algorithm? I/O? Memory? Contention?
  4. Propose: 2-3 options with trade-offs (speed vs readability, memory vs CPU, etc.)
  5. Verify: After optimization, re-measure to confirm improvement.

The cardinal rule: Profile first, optimize second. Gut feelings about performance are wrong more often than right.


Profiling Toolkits

Rust

ToolPurposeCommand
cargo benchMicro-benchmarks (criterion)cargo bench
cargo flamegraphCPU flamegraph visualizationcargo flamegraph --bin <name>
perfLinux perf eventsperf record --call-graph dwarf ./target/release/<bin>
valgrind --tool=callgrindInstruction-level profilingvalgrind --tool=callgrind ./target/release/<bin>
cargo bloatBinary size analysiscargo bloat --release
DHAT (via valgrind)Heap allocation profilingvalgrind --tool=dhat ./target/release/<bin>

Quick benchmark setup with criterion:

rust
// benches/my_bench.rs
use criterion::{criterion_group, criterion_main, Criterion};

fn benchmark_function(c: &mut Criterion) {
    c.bench_function("descriptive name", |b| {
        b.iter(|| {
            // code to benchmark
        })
    });
}

criterion_group!(benches, benchmark_function);
criterion_main!(benches);

TypeScript / React

ToolPurposeHow
React DevTools ProfilerComponent render timingBrowser extension, Profiler tab
LighthouseOverall web performanceChrome DevTools > Lighthouse
console.time() / console.timeEnd()Quick timingWrap suspicious code
webpack-bundle-analyzerBundle size analysisbun run build --analyze
performance.mark() / performance.measure()Web Performance APIPrecise timing of code sections
React <Profiler> componentProgrammatic render profilingWrap components in <Profiler>

Key React performance checks:

  • Unnecessary re-renders (use React DevTools "Highlight updates")
  • Large component trees re-rendering from state at the top
  • Missing useMemo / useCallback for expensive computations or stable references
  • Bundle size — are you importing entire libraries for one function?

Django / Python

ToolPurposeCommand
django-debug-toolbarSQL queries, template timingAdd to INSTALLED_APPS
cProfileFunction-level profilingpython -m cProfile -s cumtime manage.py <command>
py-spySampling profiler (no code changes)py-spy record -o profile.svg -- python manage.py runserver
silkDjango request/response profilingAdd to middleware
memory_profilerLine-by-line memory usage@profile decorator
django.db.connection.queriesRaw SQL query logfrom django.db import connection; print(connection.queries)

Key Django performance checks:

  • N+1 queries (use django-debug-toolbar or assertNumQueries in tests)
  • Missing database indexes on filtered/ordered columns
  • Unoptimized querysets (use .only(), .defer(), .values() when appropriate)
  • Template rendering time (are you doing computation in templates?)

Complexity Analysis

Big-O Quick Reference

ComplexityNameExampleScale
O(1)ConstantHashMap lookupHandles any size
O(log n)LogarithmicBinary searchHandles billions
O(n)LinearSingle pass over collectionHandles millions
O(n log n)LinearithmicGood sorting (merge, heap)Handles millions
O(n^2)QuadraticNested loops over same collectionHandles thousands
O(n^3)CubicTriple nested loopsHandles hundreds
O(2^n)ExponentialBrute-force subsetsHandles ~25

When to Care

  • O(1) to O(n): Almost never a problem. Don't optimize.
  • O(n log n): Fine for most use cases. Only optimize for very hot paths.
  • O(n^2): Watch the input size. Fine for n < 1000, problematic for n > 10000.
  • O(n^3) or worse: Red flag. Look for algorithmic improvements first.

Cyclomatic and Data Flow Complexity

Per the project coding standards:

  • Cyclomatic complexity: Must be < 25 per function
  • Data flow complexity: Must be < 25 per function

When complexity exceeds these thresholds, the refactoring-advisor skill should be used to plan decomposition.


Common Optimization Patterns

Rust-Specific

PatternWhenTrade-off
Replace Vec<Box<dyn Trait>> with enum dispatchKnown, finite set of variantsLess flexible, but no heap allocation per item
Use &str instead of StringFunction doesn't need ownershipLifetime annotations may complicate API
Pre-allocate with Vec::with_capacity()Known or estimated collection sizeMinor memory overhead if estimate is wrong
Use SmallVecUsually-small collectionsExtra dependency, more complex type
Replace clone() with borrowsCloning on hot pathsMore lifetime management
Use rayon for data parallelismCPU-bound work on large collectionsThread pool overhead for small collections

React/TypeScript-Specific

PatternWhenTrade-off
React.memo()Component re-renders with same propsExtra memory for memoized result, stale risk if deps wrong
useMemo / useCallbackExpensive computation or stable reference neededComplexity, memory for cache
Code splitting with React.lazy()Large bundles, route-level splittingLoading states, waterfall risk
Virtualized lists (react-window)Rendering 100+ items in a listMore complex implementation
Debounce/throttleFrequent events (scroll, resize, input)Delayed response

Django/Python-Specific

PatternWhenTrade-off
select_related()ForeignKey lookups in loopsLarger initial query, but fewer total queries
prefetch_related()Reverse FK / M2M lookups in loopsExtra query, but bounded number of queries
.values() / .values_list()Only need specific columnsLose model instance methods
Database indexesFrequently filtered/ordered columnsSlower writes, disk space
Caching (django.core.cache)Expensive queries repeated oftenStale data risk, cache invalidation complexity
Bulk operationsCreating/updating many rowsLess granular error handling

Trade-Off Analysis Template

When recommending an optimization, always present:

markdown
### Optimization: [Description]

**Current:** [What's happening now, with measured performance]
**Proposed:** [What to change]

| Dimension | Before | After |
|---|---|---|
| Time complexity | O(n^2) | O(n log n) |
| Space complexity | O(1) | O(n) |
| Readability | Simple nested loop | Sort + scan requires comment |
| Maintainability | Easy to modify | Requires understanding of invariant |

**Recommendation:** [Proceed / Defer / Skip]
**Justification:** [Why this trade-off is or isn't worth it in this context]

Anti-Patterns: When NOT to Optimize

  • Premature optimization. If there's no measured performance problem, don't create complexity to solve one.
  • Micro-optimizing cold paths. That function called once at startup? Leave it readable.
  • Optimizing without benchmarks. "I think this is slow" is not evidence. Profile first.
  • Sacrificing correctness for speed. Fast and wrong is worse than slow and right.
  • Cargo-culting. "I read that HashMap is faster" — depends on the size, access pattern, and key type. Measure in your context.

Integration

  • Data: Performance findings logged to MEMORY.md
  • Tools: Can run profiling/benchmarking tools without asking (see execution policies in AGENTS.md)
  • Refactoring: When optimization requires restructuring, use the refactoring-advisor skill for safe migration planning
  • Trade-offs: Every optimization recommendation includes a trade-off table

Arc skill — Performance profiling and optimization

Heefeg gestallte Froen

Wat mécht de KI-Skill Performance Optimizer?

Agents should invoke this skill for slow code, high CPU/memory, latency, large data processing, algorithmic complexity, profiling plans, benchmarks, or optimization requests. Profiles first and weighs trade-offs before changing code.

Firwat Performance Optimizer op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Performance Optimizer besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Performance Optimizer an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/Firstp1ck/pi-coding-agent-forge/tree/main/pi-skill-performance-optimizer/skills/performance-optimizer an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Performance Optimizer benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Performance Optimizer benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Performance Optimizer domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Performance Optimizer gratis?

Jo. De Skill gëtt vum Firstp1ck ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇