Logo di Performance Optimizer

Performance Optimizer

Community
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.

Panoramica

AutoreFirstp1ck
Repositorypi-coding-agent-forge
Nome della skillperformance-optimizer
Stelle
93
Fork
22
File inclusi
Solo istruzioni
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da Firstp1ck su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Performance Optimizer in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/Firstp1ck/pi-coding-agent-forge/tree/main/pi-skill-performance-optimizer/skills/performance-optimizer
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Nuova skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella nella cartella delle skill di quell'agente.

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
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Performance Optimizer in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Performance Optimizer non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Performance Optimizer non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

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

Domande frequenti

Cosa fa la skill IA 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.

Perché usare Performance Optimizer su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Performance Optimizer è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Performance Optimizer in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/Firstp1ck/pi-coding-agent-forge/tree/main/pi-skill-performance-optimizer/skills/performance-optimizer. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Performance Optimizer?

Qualsiasi modello che colleghi in TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Performance Optimizer?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Performance Optimizer: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Performance Optimizer è gratuita?

Sì. È pubblicata su GitHub da Firstp1ck con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, modelli o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇