Logotipo de Performance Optimization

Performance Optimization

Comunidad
UnpaidAttention
performance-optimization

Make code measurably faster or leaner without breaking it — define a target, measure a baseline, profile to find the ACTUAL bottleneck, apply optimizations in a fixed order of leverage, and re-verify correctness after each change. Trigger this when the user reports slowness, high latency, memory growth, or cost, sets a performance budget, or asks to "optimize" or "speed up" something. Do NOT trigger for functional bugs that happen to involve timing (use debugging-methodology) or for restructuring at equal performance (use safe-refactoring) — this skill exists to move a number.

Add to TypingMind

Descripción general

EditorUnpaidAttention
Repositoriofable5-methodology
Nombre de la habilidadperformance-optimization
Estrellas
94
Forks
21
Archivos incluidos
Solo instrucciones
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando la petición encaja con la habilidad.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • Todo en las instrucciones

    Todo lo que necesita el modelo está en las instrucciones: no hay archivos adicionales que sincronizar.

  • Código abierto

    Publicada por UnpaidAttention en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Performance Optimization en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/UnpaidAttention/fable5-methodology/tree/main/skills/performance-optimization
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/UnpaidAttention/fable5-methodology.git /tmp/fable5-methodology
mkdir -p .claude/skills
cp -r /tmp/fable5-methodology/skills/performance-optimization .claude/skills/performance-optimization
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Performance Optimization en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición encaja con la habilidad, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Performance Optimization automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Performance Optimization no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición que encaja con la habilidad, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo seguirá.

Performance Optimization

Optimization without measurement is guessing with extra steps. Intuition about bottlenecks is wrong often enough that acting on it unmeasured wastes the time it was meant to save. The number rules everything: define it, baseline it, move it, prove it.

Step 1: Define the target and the workload

  1. Pin the metric AND the goal: "p95 of /search under 300 ms at 50 rps", "import of the 1M-row file under 2 min", "RSS under 512 MB". No target = no definition of done = optimization that never ends. If the user gave none, propose one and get a nod.
  2. Pin the workload: realistic data at realistic scale. A query fast on 100 dev rows and slow on 10M production rows is the NORMAL case, not an edge case — measuring on toy data measures nothing.

Step 2: Baseline before any change

Measure the current number, three runs (warm), record median and spread in your notes. Every later claim of improvement is relative to this recorded baseline — "feels faster" is not a result.

Step 3: Profile — find where the time actually goes

Use the stack's profiler, not code reading:

  • Rust: cargo flamegraph / perf; --release always — debug-build numbers are fiction.
  • Node/TS: node --prof or 0x/clinic flame; console.time brackets for coarse cuts.
  • Python: py-spy record (no code change) or cProfile + snakeviz.
  • SQL: EXPLAIN (ANALYZE, BUFFERS) on the real query with real data volume.
  • Anything network-y: count the requests first — chattiness dominates before CPU does.

Read the profile for the top consumer. Rule: no optimization is applied to code the profile didn't indict. If the profile surprises you (it usually does), that surprise just saved you a week of optimizing the wrong thing.

Step 4: Apply strategies in order of leverage

Try each level; only descend when the level above is exhausted for the indicted hotspot:

  1. Don't do the work: cache repeated computation, dedupe repeated calls, early-exit, skip unused fields, paginate instead of load-all.
  2. Do the work fewer times / in bulk: fix N+1 queries (join or batch), batch writes, buffer I/O, debounce, move loop-invariant work out of the loop.
  3. Do the work better: right algorithm/data structure — dict lookup over list scan, sort-then-merge over nested loops, the missing database index.
  4. Tune the machinery: connection pools, buffer sizes, compiler/runtime flags, --release.
  5. Parallelize: only now — parallel versions of wasteful work multiply the waste and add race conditions to it.
  6. Micro-optimize: last, rarely, and only with the profile still pointing there.

Step 5: One change, two measurements

For EACH optimization: apply it alone → re-run the metric → re-run the correctness suite. Keep a running table in your notes:

Changep95 beforep95 afterTests
Add index on orders(user_id, created_at)1400 ms310 msgreen
Batch the price lookups310 ms180 msgreen

A change that doesn't move the number gets REVERTED, even if it "should" help — dead optimizations are complexity with no dividend. A change that breaks a test is a bug, not a trade-off, unless the user explicitly accepts the trade.

Step 6: Stop at the target

When the target from Step 1 is met: stop. Further optimization is scope creep with a performance costume. Report the table, the final number vs. target, and any identified-but- unneeded next levers ("materialized view would take it to ~80 ms if ever needed").

Worked example

"The dashboard takes 8 s to load; get it under 2 s."

  • Target: p95 page-data endpoint < 2 s on the staging dataset (4M rows). Baseline: 8.1 s.
  • Profile (EXPLAIN + request log): intuition said "slow rendering"; reality: 41 sequential queries (N+1 on widgets) + one seq-scan aggregate. Rendering was 90 ms — untouched.
  • Level 2: batch widget query → 41 calls → 2. 8.1 s → 2.9 s. Suite green.
  • Level 3: index for the aggregate's filter → seq scan → index scan. 2.9 s → 1.3 s. Green.
  • Target met — STOP. Cache layer (level 1) noted as unneeded next lever, not built.
  • Report: table of both changes with numbers, final 1.3 s vs 2 s target, suite green.

Done when

The target metric from Step 1 is met and demonstrated by recorded before/after measurements on the realistic workload; every applied change is in the table with its own measured delta; the full correctness suite is green after the final state; ineffective changes were reverted; and no code the profiler didn't indict was "optimized".

Preguntas frecuentes

¿Qué hace la habilidad de IA Performance Optimization?

Make code measurably faster or leaner without breaking it — define a target, measure a baseline, profile to find the ACTUAL bottleneck, apply optimizations in a fixed order of leverage, and re-verify correctness after each change. Trigger this when the user reports slowness, high latency, memory growth, or cost, sets a performance budget, or asks to "optimize" or "speed up" something. Do NOT trigger for functional bugs that happen to involve timing (use debugging-methodology) or for restructuring at equal performance (use safe-refactoring) — this skill exists to move a number.

¿Por qué usar Performance Optimization en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Performance Optimization está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Performance Optimization en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/UnpaidAttention/fable5-methodology/tree/main/skills/performance-optimization. TypingMind lee el archivo SKILL.md de esa carpeta e instala su contenido como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Performance Optimization?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Performance Optimization?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Performance Optimization con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Performance Optimization?

UnpaidAttention la ha publicado en GitHub. Consulta el repositorio para conocer las condiciones de la licencia. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver el directorio

Crea ya tu propio espacio de trabajo con IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇