# Copilot Ld Copilot Ld Libperf

> libperf Skill

- Skill: `tomevault-io/copilot-ld-copilot-ld-libperf` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/copilot-ld-copilot-ld-libperf`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/copilot-ld-copilot-ld-libperf/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/copilot-ld-copilot-ld-libperf

---


# libperf Skill

## When to Use

- Writing performance tests for critical code paths
- Benchmarking function execution time and memory
- Detecting performance regressions in CI
- Validating scaling characteristics (O(n) vs O(n²))

## Key Concepts

**benchmark**: Runs a function multiple times and collects timing/memory stats.

**validateDuration/validateMemory**: Assert that benchmarks meet performance
requirements.

**ScalingAnalyzer**: Analyzes how performance scales with input size.

## Usage Patterns

### Pattern 1: Basic benchmark

```javascript
import { benchmark, validateDuration } from "@copilot-ld/libperf";

const result = await benchmark(
  async () => {
    await myFunction(input);
  },
  { iterations: 100 },
);

validateDuration(result, 50); // Assert max 50ms
```

### Pattern 2: Scaling analysis

```javascript
import { ScalingAnalyzer } from "@copilot-ld/libperf";

const analyzer = new ScalingAnalyzer();
const scaling = await analyzer.analyze(fn, [100, 1000, 10000]);
// scaling.type: "linear" | "sublinear" | "superlinear"
```

## Integration

Performance tests use `.perf.js` extension. Run via `npm run test:perf`.

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/copilot-ld) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-13 -->

