Logo de Performance Profiling

Performance Profiling

Comunidade
nahid-sparktales
performance-profiling

Find where the time actually goes before changing anything — define the metric and workload, build a repeatable baseline with its spread, profile on the right axis, confirm the suspected hotspot by removing its work, then re-measure under identical conditions. Use when something is slow, when an optimization is about to be written from a hunch, or when a speedup is being claimed without comparable numbers. Not for reading code to guess what is expensive, not for micro-tuning with no measured user impact, and not a licence to profile production without asking.

Visão geral

Publicado pornahid-sparktales
Repositórioagent-dispatcher
Nome da habilidadeperformance-profiling
Estrelas
58
Forks
5
Arquivos incluídos
1
LicençaMIT
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    As habilidades de IA são escritas em Markdown simples, não em código específico de um provedor. Por isso, funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • Arquivos incluídos: 1

    Scripts, templates e referências que o modelo pode ler enquanto trabalha. Os arquivos são somente para leitura e nunca são executados.

  • Código aberto

    Publicada por nahid-sparktales no GitHub. Leia os arquivos da habilidade antes de instalá-la.

Instalação

Instale a habilidade de IA Performance Profiling no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL abaixo, que aponta para a pasta da habilidade, e confirme.
    https://github.com/nahid-sparktales/agent-dispatcher/tree/main/skills/quality/performance-profiling
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Adicionar habilidade → Via URL do GitHub. Depois, cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/nahid-sparktales/agent-dispatcher.git /tmp/agent-dispatcher
mkdir -p .claude/skills
cp -r /tmp/agent-dispatcher/skills/quality/performance-profiling .claude/skills/performance-profiling
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Performance Profiling em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Performance Profiling automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Performance Profiling não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

Performance profiling

The function that looks expensive and the function that is expensive are two different populations with a modest overlap. Every optimization written before a profile is a guess with a diff attached.

When this fires

  • Something is measurably slow, or a latency, memory or throughput target is being missed.
  • An optimization is about to be written on the strength of how the code reads.
  • A speedup is being reported without a baseline, a spread, or comparable conditions.

It does not fire for correctness work, and it does not fire for a change whose only justification is that a faster construct exists — a faster loop inside 2% of the runtime is not an improvement, it is churn.

Procedure

  1. Define the metric and the workload. "Slow" is not a metric. Pick one: p95 latency of this request under this load, peak resident memory, time to first byte, wall-clock of this job, rows per second. Say which environment, which data, and what would count as good enough.
  2. Reproduce the slowness in a harness you can run repeatedly, with representative data. Toy input profiles a different program: an N+1 query is invisible at ten rows, and a quadratic scan is free at n=12.
  3. Establish the baseline properly. Run it several times and record every run, not the best one. Report the median and the spread. If the spread is wider than the improvement you are chasing, the harness is not ready and nothing measured on it will be believable.
  4. Profile rather than guess, on the axis that matches the metric. Wall-clock sampling for "it takes too long", a CPU profile for compute, an allocation or heap profile for memory, the browser's performance trace for rendering and main-thread work, the database's own query plan for a slow query, distributed traces for a request crossing services. Use whatever the runtime ships; name the tool you used in the report.
  5. Read the profile carefully before believing it. Separate self time from inclusive time — a frame near the top of the list may be cheap itself and merely called by everything. Check whether the time is spent computing or waiting: a CPU profile of an I/O-bound program shows an idle program, and chasing its top frame is the single most common wrong turn here.
  6. Confirm the hotspot before optimizing it. Delete, stub or short-circuit the suspected work in a scratch copy and re-measure. If the total does not move, it was not the bottleneck however bad the code looked. This experiment costs minutes and prevents days.
  7. Ask whether the work can be avoided before making it faster. Fewer round trips, less data fetched, computed once instead of per item, the right index, the result cached at a layer where invalidation is tractable. The cheapest optimization is the work that no longer happens.
  8. Change one thing. Two changes measured together give you one number and no attribution.
  9. Re-measure under identical conditions — same machine, data, build configuration, warm or cold state, same number of runs. A release build against a debug baseline is not a result.
  10. Check correctness alongside speed. Caching, concurrency, laziness and batching all change semantics. Run the test suite and state the new invariants someone now has to maintain: invalidation, ordering, memory ceiling, error handling under partial failure.
  11. Report absolutes with their spread, name the fraction attributable to the change, and say what the bottleneck is now. Then remove the harness, or promote it deliberately to a repeatable benchmark that someone owns.

The plausible-but-wrong hotspot

  • The nested loop over a list of twelve. It reads badly and costs nothing.
  • The frame with the most samples that is merely popular. Inclusive time is not self time.
  • A debug build, or profiler overhead. Instrumentation distorts small hot functions most; cross-check a sampling profile against plain wall-clock timing of the whole workload.
  • The first run. Cold caches, JIT warm-up, connection pools and lazy imports are paid once. Decide whether the metric is the cold path or the warm one, then measure that one consistently.
  • The micro-benchmark the compiler optimized away. A result nobody consumes may never be computed; a number too good to be true usually is.
  • The environment that is not the user's. A local SSD and a loopback network hide precisely the I/O and latency costs that make production slow.

Checklist

  • Metric, workload and environment written down before measuring
  • Baseline taken from multiple runs, all recorded, with spread
  • A profile was taken, on an axis that matches the metric
  • Self time and inclusive time distinguished; compute separated from waiting
  • The hotspot was confirmed by removing its work and re-measuring
  • One change at a time
  • After-measurement under identical conditions
  • Correctness re-checked and new invariants named
  • Remaining bottleneck stated

Failure handling

  • No profiler for this runtime — bracket timers around segments and bisect the region by halving, the same way you would isolate a bug. Say plainly that the attribution is coarse.
  • The difference is inside the noise — report the change as unproven. A percentage quoted from two single runs is noise with a decimal point.
  • It only reproduces in production — do not attach a profiler to production on your own judgement. Profiling costs overhead and can take load; stop and ask, and prefer a staging replay, a captured trace, or existing telemetry.
  • The bottleneck is in a dependency or in infrastructure — report it with the evidence. Do not rewrite a library or resize infrastructure on a hunch.
  • The improvement requires a destructive or outward-facing step to validate — a schema migration, a cache flush, a config change on a shared environment. Stop and ask; measure against a local or branch copy first.

Evidence to report

The metric and workload; the harness command; machine, data and build configuration; every baseline run, not the best one; the profile itself — top frames, query plan or trace — and how it was taken; the confirmation experiment; the after-numbers under the same conditions with spread; the correctness run; and the bottleneck that is now next. Measured, optimized and verified are three different claims: "2x faster" with none of the above is a fourth one, which is a guess.

Arquivos incluídos

O modelo lê esses arquivos sob demanda enquanto a habilidade está carregada. Eles são disponibilizados para leitura e nunca são executados.

Perguntas frequentes

O que a habilidade de IA Performance Profiling faz?

Find where the time actually goes before changing anything — define the metric and workload, build a repeatable baseline with its spread, profile on the right axis, confirm the suspected hotspot by removing its work, then re-measure under identical conditions. Use when something is slow, when an optimization is about to be written from a hunch, or when a speedup is being claimed without comparable numbers. Not for reading code to guess what is expensive, not for micro-tuning with no measured user impact, and not a licence to profile production without asking.

Por que usar Performance Profiling no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. A habilidade Performance Profiling é escrita em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. No TypingMind, você usa suas próprias chaves de API e paga diretamente aos provedores, em vez de pagar uma assinatura por licença de usuário. Suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Performance Profiling no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/nahid-sparktales/agent-dispatcher/tree/main/skills/quality/performance-profiling. O TypingMind lê o arquivo SKILL.md, reúne os arquivos da habilidade e a instala para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Performance Profiling?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Performance Profiling?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Performance Profiling com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Performance Profiling é gratuita?

Sim. A habilidade é publicada no GitHub por nahid-sparktales sob a licença MIT. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, templates ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas que ele pode acionar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA dá ao modelo o conhecimento e as orientações de que ele precisa: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver lista completa

Crie seu próprio espaço de trabalho com IA agora

Inscreva-se na nossa newsletter para receber avisos sobre novos recursos e futuros sorteios 👇