Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

source-command-benchmark

БесплатноБез исполняемых скриптовНе проверен

Migrated source command `benchmark`

databaytот databayt★ 19 звёзд на GitHub

Об этом скилле

source-command-benchmark

Use this skill when the user asks to run the migrated source command benchmark.

Command Template

Benchmark Command - Performance Testing

Run performance benchmarks on components, functions, and API endpoints

Usage

/benchmark [target] [options]

Examples

/benchmark StudentTable             # Benchmark component render
/benchmark api/students             # Benchmark API endpoint
/benchmark utils/calculate --iterations=1000  # Benchmark function
/benchmark all --compare=main      # Compare with main branch

Process

1. Identify Benchmark Target

  • Component render performance
  • Function execution time
  • API response time
  • Database query performance
  • Bundle size impact

2. Generate Benchmark Suite

// benchmark/StudentTable.bench.ts
import { bench, describe } from 'vitest';
import { render } from '@testing-library/react';
import { StudentTable } from '@/components/school-dashboard/listings/students/table';

describe('StudentTable Performance', () => {
  bench('render with 100 students', () => {
    render(<StudentTable data={generateStudents(100)} />);
  });

  bench('render with 1000 students', () => {
    render(<StudentTable data={generateStudents(1000)} />);
  });

  bench('sort by name', () => {
    const table = render(<StudentTable data={generateStudents(100)} />);
    table.rerender(<StudentTable data={generateStudents(100)} sortBy="name" />);
  });
});

3. Performance Metrics

Component Metrics

const metrics = {
  renderTime: "Time to first render",
  rerenderTime: "Time for updates",
  memoryUsage: "Heap size delta",
  componentCount: "React component instances",
  domNodes: "DOM node count",
}

Function Metrics

bench(
  "function performance",
  () => {
    // Measure:
    // - Execution time (ms)
    // - CPU cycles
    // - Memory allocation
    // - Garbage collection impact
  },
  {
    iterations: 1000,
    warmup: 100,
  }
)

API Metrics

const apiMetrics = {
  responseTime: "Total response time",
  ttfb: "Time to first byte",
  throughput: "Requests per second",
  p50: "50th percentile latency",
  p95: "95th percentile latency",
  p99: "99th percentile latency",
}

4. Database Query Benchmarks

bench("fetch students with relations", async () => {
  await db.student.findMany({
    where: { schoolId },
    include: {
      guardian: true,
      classes: true,
      attendance: {
        take: 10,
      },
    },
  })
})

// Analyze query plan
const explain = await db.$queryRaw`
  EXPLAIN ANALYZE
  SELECT * FROM "Student"
  WHERE "schoolId" = ${schoolId}
`

5. Bundle Size Analysis

// Measure bundle impact
import { analyzeBundle } from "@next/bundle-analyzer"

const analysis = await analyzeBundle({
  before: "main",
  after: "feature-branch",
  modules: ["StudentTable", "dependencies"],
})

// Report size changes
console.log(`
  Bundle size impact:
  - Main bundle: +${analysis.mainBundle}KB
  - Chunk size: +${analysis.chunkSize}KB
  - First load: +${analysis.firstLoad}KB
`)

Benchmark Configuration

Options

interface BenchmarkOptions {
  iterations?: number // Number of runs (default: 100)
  warmup?: number // Warmup runs (default: 10)
  timeout?: number // Max time per tests (default: 60s)
  compare?: string // Branch to compare against
  threshold?: number // Performance regression threshold (%)
  output?: "json" | "html" // Report format
}

Performance Budget

const performanceBudget = {
  components: {
    firstRender: 100, // ms
    rerender: 50, // ms
    memoryDelta: 5, // MB
  },
  api: {
    p50: 200, // ms
    p95: 500, // ms
    p99: 1000, // ms
  },
  bundle: {
    main: 200, // KB gzipped
    firstLoad: 100, // KB
    chunkSize: 50, // KB
  },
}

Hogwarts Platform Benchmarks

Critical Components

# Student list performance
/benchmark StudentTable --iterations=100

# Form validation speed
/benchmark StudentForm validation --iterations=1000

# Dashboard render time
/benchmark Dashboard --with-data

API Endpoints

# Bulk operations
/benchmark api/students/bulk-create --payload=100

# Search performance
/benchmark api/search --query="complex filter"

# Multi-tenant queries
/benchmark api/students --with-tenant-isolation

Database Operations

# N+1 query detection
/benchmark queries/student-with-classes --detect-n+1

# Index effectiveness
/benchmark queries/attendance-by-date --explain

# Transaction performance
/benchmark transactions/enrollment --concurrent=10

Comparison & Regression Detection

Branch Comparison

// Compare with main branch
const comparison = {
  baseline: await runBenchmark("main"),
  current: await runBenchmark("HEAD"),

  regression: current.time > baseline.time * 1.1, // 10% threshold
  improvement: current.time < baseline.time *
Полный SKILL.md на GitHub

Установить source-command-benchmark в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл source-command-benchmark?

Migrated source command `benchmark`

Как установить скилл source-command-benchmark?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл source-command-benchmark запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить source-command-benchmark с