type-design-performance

Identify and resolve performance bottlenecks in .NET type design.

Updated Apr 23, 2026
One-click install
npx skills add https://github.com/MudraMartin/dotlight-skillset --skill type-design-performance-mudramartin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: type-design-performance
Source: https://github.com/MudraMartin/dotlight-skillset/tree/main/dotnet/csharp-type-design-performance
Command: npx skills add https://github.com/MudraMartin/dotlight-skillset --skill type-design-performance-mudramartin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps .NET developers design types and APIs with performance in mind, reducing overhead and improving efficiency.

Core Features & Use Cases

  • Type Sealing: Avoids unnecessary virtual method calls and communicates API intent.
  • Readonly Structs: Ensures value types are immutable, preventing defensive copies.
  • Static Pure Functions: Enhances performance and testability.
  • Defer Enumeration: Avoids materializing enumerables until necessary.
  • Immutable Collections: Provides an API boundary for data integrity.
  • Use Case: When developing high-performance .NET applications, this Skill can help identify and resolve performance bottlenecks in type design.

Quick Start

Run the type-design-performance skill to review your type design for performance optimizations.

Frequently Asked Questions about type-design-performance

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

FAQPage Schema
How do I optimize .NET type design for performance bottlenecks?

To optimize .NET type design for performance, you should seal classes to prevent unnecessary virtual method calls, use readonly structs to ensure immutability, and leverage static pure functions to reduce overhead and improve testability.

Why does using readonly structs improve C# application performance?

Readonly structs improve C# application performance by enforcing value type immutability, which prevents the compiler from generating hidden defensive copies when accessing struct members, thereby reducing memory overhead and execution time.

When do I need to defer enumeration in .NET to avoid performance issues?

You need to defer enumeration in .NET when handling large or chained data sets to avoid premature materialization, which prevents unnecessary memory allocation and keeps performance high until the data is actually required.

What's the best way to choose collections for high-performance .NET APIs?

The best way to choose collections for high-performance .NET APIs is to use immutable collections, which provide a safe API boundary for data integrity while minimizing overhead and reducing the risk of unintended mutations.

Can I use static pure functions to resolve .NET type design overhead?

Yes, you can use static pure functions to resolve .NET type design overhead by eliminating instance state dependencies, which enhances both computational performance and code testability without altering external behavior.