dotnet-performance-discipline

Enforces allocation-conscious coding rules for high-performance C# and .NET hot paths.

2|1|Updated May 11, 2019
One-click install
npx skills add https://github.com/guitarrapc/dotfiles-win --skill dotnet-performance-discipline-guitarrapc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-performance-discipline
Source: https://github.com/guitarrapc/dotfiles-win/tree/main/HOME/.agents/skills/dotnet-performance-discipline
Command: npx skills add https://github.com/guitarrapc/dotfiles-win --skill dotnet-performance-discipline-guitarrapc

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing fast C# code on hot paths requires consistent discipline around allocations, pooled buffer ownership, and span usage, and mistakes like storing a rented array in a struct cause silent data corruption rather than crashes. This Skill provides a standing rule set so every hot-path decision follows proven patterns. ## Core Features & Use Cases - Pooled Buffer Ownership Rules: Defines who may hold an ArrayPool rental, prohibits rented arrays in structs and Memory<T> over pooled storage, and provides ranked safe patterns from Span lending to fail-loud owner classes. - Hot-Path Prohibitions: Bans LINQ, capturing closures, regex, per-item growing collections, boxing, and per-item virtual dispatch in code that runs per item, request, or token. - Allocation Verification: Explains how to validate allocation changes with BenchmarkDotNet MemoryDiagnoser and git worktree baselines instead of trusting stale committed benchmark reports. - Use Case: When reviewing a PR that adds a record struct holding an array rented from ArrayPool, apply the ownership rules to reject the design and replace it with a caller-lent Span<T> pattern. ## Quick Start Review this C# method that runs per request and tell me which allocation and buffer-ownership rules it violates.

Frequently Asked Questions about dotnet-performance-discipline

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
When should I use FrozenDictionary instead of Dictionary?

Use FrozenDictionary or FrozenSet for read-mostly lookup tables built once at startup that outlive many queries. They cost more to construct but less to query, and span-based alternate lookups avoid allocating strings at query time.