performance-optimization — community performance-optimization, video-processing-engine-auth-lambda, community, ide skills, Claude Code, Cursor, Windsurf

v1.0.0
GitHub

About this Skill

Perfect for Backend Agents needing advanced performance optimization capabilities. AWS Lambda responsável pela autenticação do sistema de processamento de vídeos, integrada ao Amazon Cognito e utilizada pelo API Gateway para controle de acesso às APIs do Hackathon FIAP Pós Tech em Arquitetura de Software.

diegoknsk diegoknsk
[0]
[0]
Updated: 2/27/2026

Agent Capability Analysis

The performance-optimization skill by diegoknsk is an open-source community AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance.

Ideal Agent Persona

Perfect for Backend Agents needing advanced performance optimization capabilities.

Core Value

Empowers agents to optimize code performance using techniques like Span<T>, ArrayPool<T>, and ValueTask<T>, reducing memory allocations and improving execution speed.

Capabilities Granted for performance-optimization

Optimizing hot paths in code
Reducing memory allocations in data-intensive applications
Improving execution speed in real-time systems

! Prerequisites & Limits

  • Requires profiling to identify performance bottlenecks
  • Limited to .NET and Python environments
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

performance-optimization

Install performance-optimization, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command...

SKILL.md
Readonly

Performance Optimization — .NET

Quando Usar

  • Otimização de performance, redução de alocações
  • Span<T>, Memory<T>, ArrayPool<T>, ValueTask<T>
  • Hot paths, queries compiladas, zero-allocation
  • Palavras-chave: "performance", "otimizar", "alocações", "Span", "ArrayPool", "rápido", "hot path"

⚠️ Importante: Otimize apenas com profiling (medição real). Código legível > performance prematura.

Princípios Essenciais

✅ Fazer

  • Usar Span<T> para manipulação de arrays/strings sem alocações (parsing, slicing)
  • Usar ArrayPool<T> para arrays temporários (reutilização, menos GC pressure)
  • Usar ValueTask<T> quando operação frequentemente completa de forma síncrona
  • Compiled queries (EF Core) para queries repetitivas
  • AsNoTracking() em EF Core para queries read-only
  • Profiling primeiro: medir antes de otimizar (BenchmarkDotNet)

❌ Não Fazer

  • Nunca otimizar sem medir (profiling)
  • Nunca sacrificar legibilidade por micro-otimizações sem impacto
  • Nunca usar Span<T> em métodos async (usar Memory<T>)
  • Nunca esquecer de devolver arrays ao ArrayPool (usar try/finally)
  • Nunca assumir que "mais rápido" = "melhor" (trade-offs)

Regra de ouro: Profile → Otimize → Meça novamente. Span<T> + ArrayPool<T> cobrem 80% dos casos.

Checklist Rápido

  1. Profile primeiro: BenchmarkDotNet ou dotTrace para identificar hot paths
  2. Span<T> para parsing, slicing, manipulação de strings sem alocações
  3. ArrayPool<T> para arrays temporários (Rent → usar → Return no finally)
  4. ValueTask<T> para operações que frequentemente completam síncronamente
  5. AsNoTracking() em queries EF Core read-only
  6. Compiled queries para queries EF Core repetitivas
  7. Measure again: validar que otimização teve efeito

Exemplo Mínimo

Cenário: Parsing de CSV com Span<T> e ArrayPool<T> (zero alocações)

Span<T> — Parsing sem Alocações

csharp
1// ❌ Alocações desnecessárias 2public static string[] ParseCsvLine(string line) 3{ 4 return line.Split(','); // Aloca array de strings 5} 6 7// ✅ Zero alocações com Span 8public static void ParseCsvLine(ReadOnlySpan<char> line, Span<Range> ranges, out int count) 9{ 10 count = 0; 11 int start = 0; 12 13 for (int i = 0; i <= line.Length; i++) 14 { 15 if (i == line.Length || line[i] == ',') 16 { 17 ranges[count++] = new Range(start, i); 18 start = i + 1; 19 } 20 } 21} 22 23// Uso 24var line = "John,Doe,30".AsSpan(); 25Span<Range> ranges = stackalloc Range[10]; // No stack, zero alocação 26ParseCsvLine(line, ranges, out int count); 27 28for (int i = 0; i < count; i++) 29{ 30 var field = line[ranges[i]]; // ReadOnlySpan<char>, zero alocação 31 Console.WriteLine(field.ToString()); 32}

ArrayPool<T> — Reutilização de Arrays

csharp
1using System.Buffers; 2 3// ❌ Alocação a cada chamada 4public byte[] ProcessData(int size) 5{ 6 var buffer = new byte[size]; // GC pressure 7 // ... processa 8 return buffer; 9} 10 11// ✅ Reutilização com ArrayPool 12public void ProcessData(int size, Span<byte> destination) 13{ 14 var buffer = ArrayPool<byte>.Shared.Rent(size); // Reutiliza array 15 16 try 17 { 18 var span = buffer.AsSpan(0, size); 19 // ... processa span 20 span.CopyTo(destination); 21 } 22 finally 23 { 24 ArrayPool<byte>.Shared.Return(buffer); // Devolve ao pool 25 } 26}

ValueTask<T> — Operações Frequentemente Síncronas

csharp
1// ✅ ValueTask quando operação pode ser síncrona (ex.: cache hit) 2public class CachedUserRepository(IUserRepository repository, IMemoryCache cache) 3{ 4 public async ValueTask<User?> GetByIdAsync(Guid id, CancellationToken ct = default) 5 { 6 // Cache hit: retorna de forma síncrona (sem alocação de Task) 7 if (cache.TryGetValue(id, out User? cached)) 8 return cached; 9 10 // Cache miss: chama repositório (assíncrono) 11 var user = await repository.GetByIdAsync(id, ct); 12 if (user != null) 13 cache.Set(id, user, TimeSpan.FromMinutes(5)); 14 15 return user; 16 } 17} 18 19// ❌ Task<T> sempre aloca mesmo quando síncrono 20public async Task<User?> GetByIdAsync(Guid id, CancellationToken ct = default) 21{ 22 if (cache.TryGetValue(id, out User? cached)) 23 return cached; // Ainda aloca Task<User> 24 // ... 25}

Pontos-chave:

  • Span<T>: parsing, slicing, manipulação sem alocações (só código síncrono)
  • ArrayPool<T>: arrays temporários, reduz GC pressure (sempre Return no finally)
  • ValueTask<T>: quando operação frequentemente completa de forma síncrona

Memory<T> — Span para Async

Span<T> não pode ser usado em métodos async (vive no stack). Use Memory<T>:

csharp
1public async Task<int> ProcessAsync(Memory<byte> buffer, CancellationToken ct) 2{ 3 await ReadDataAsync(buffer, ct); // Memory pode ser passado para async 4 5 Span<byte> span = buffer.Span; // Converter para Span quando necessário 6 return ProcessBytes(span); 7} 8 9private int ProcessBytes(Span<byte> data) 10{ 11 int sum = 0; 12 foreach (var b in data) sum += b; 13 return sum; 14}

Compiled Queries (EF Core)

Para queries repetitivas, compile uma vez:

csharp
1private static readonly Func<AppDbContext, Guid, Task<User?>> GetUserByIdQuery = 2 EF.CompileAsyncQuery((AppDbContext ctx, Guid id) => 3 ctx.Users.AsNoTracking().FirstOrDefault(u => u.Id == id)); 4 5public async Task<User?> GetByIdAsync(Guid id, CancellationToken ct = default) 6{ 7 return await GetUserByIdQuery(context, id); 8}

Profiling com BenchmarkDotNet

bash
1dotnet add package BenchmarkDotNet
csharp
1using BenchmarkDotNet.Attributes; 2using BenchmarkDotNet.Running; 3 4[MemoryDiagnoser] 5public class ParsingBenchmark 6{ 7 private const string Input = "10,20,30,40,50"; 8 9 [Benchmark(Baseline = true)] 10 public int[] ParseWithSplit() 11 { 12 var parts = Input.Split(','); 13 var numbers = new int[parts.Length]; 14 for (int i = 0; i < parts.Length; i++) 15 numbers[i] = int.Parse(parts[i]); 16 return numbers; 17 } 18 19 [Benchmark] 20 public int[] ParseWithSpan() 21 { 22 var span = Input.AsSpan(); 23 Span<int> numbers = stackalloc int[5]; 24 // ... parsing com span 25 return numbers.ToArray(); 26 } 27} 28 29// Program.cs 30BenchmarkRunner.Run<ParsingBenchmark>();

Técnicas por Cenário

CenárioTécnicaGanho
Parsing de strings/CSVSpan<T>Zero alocações
Arrays temporários (loops)ArrayPool<T>-70% GC pressure
Cache/operações síncronasValueTask<T>-50% alocações
Queries EF Core repetitivasCompiled queries+30% throughput
Queries EF Core read-onlyAsNoTracking()+20% performance

Referências

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is performance-optimization?

Perfect for Backend Agents needing advanced performance optimization capabilities. AWS Lambda responsável pela autenticação do sistema de processamento de vídeos, integrada ao Amazon Cognito e utilizada pelo API Gateway para controle de acesso às APIs do Hackathon FIAP Pós Tech em Arquitetura de Software.

How do I install performance-optimization?

Run the command: npx killer-skills add diegoknsk/video-processing-engine-auth-lambda/performance-optimization. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for performance-optimization?

Key use cases include: Optimizing hot paths in code, Reducing memory allocations in data-intensive applications, Improving execution speed in real-time systems.

Which IDEs are compatible with performance-optimization?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for performance-optimization?

Requires profiling to identify performance bottlenecks. Limited to .NET and Python environments.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add diegoknsk/video-processing-engine-auth-lambda/performance-optimization. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use performance-optimization immediately in the current project.

Related Skills

Looking for an alternative to performance-optimization or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.

149.6k
0
AI

flags

Logo of vercel
vercel

flags is a Next.js feature management skill that enables developers to efficiently add or modify framework feature flags, streamlining React application development.

138.4k
0
Browser

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI