dotnet / dotnet/skills

Skill idea: JIT-Aware Hot Path Optimization

Open
#9 3 comments 0 reactions 0 assignees View on GitHub
area-diag skill
Dominant language
C#
Stars
5.4k
Forks
415
Avg merge
1d 4h
Merged PRs (30d)
84

Description

## Problem

The `dotnet-performance-patterns` skill (PR #6) covers customer-actionable API usage patterns. But deeper JIT-aware optimization — understanding what the JIT will actually do with specific code shapes — requires runtime-internal knowledge that generic AI lacks.

## What expert .NET knowledge would this encode?

- When the JIT will actually elide bounds checks vs. when it will not
- Which patterns trigger tier-1 vs. tier-2 compilation
- How `[MethodImpl(AggressiveInlining)]` interacts with PGO
- When `stackalloc` helps vs. hurts (stack depth, async contexts)
- The actual allocation profiles of LINQ operators and when `CollectionsMarshal` tricks are safe

## Relationship to existing skills

- `dotnet-performance-patterns` (PR #6): Customer-actionable API patterns — **complements, does not overlap**
- `dotnet-jit-optimization`: Already exists — evaluate whether it needs deepening with this content

## Skill concept

Deepen the existing `dotnet-jit-optimization` skill or create a companion that goes beyond "use the right API" into "write code shapes the JIT can optimize" — with version-specific JIT behavior knowledge.

## Why customers would value this

For customers with true hot-path code (game engines, high-frequency trading, cloud infrastructure), the difference between "the JIT inlined this" and "the JIT did not" is the difference between shipping and not shipping. This knowledge currently requires reading JIT source code or asking the runtime team directly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.