Skip to content

Inline GetAlternateLookup#773

Draft
bitfaster wants to merge 2 commits intomainfrom
users/alexpeck/inline10
Draft

Inline GetAlternateLookup#773
bitfaster wants to merge 2 commits intomainfrom
users/alexpeck/inline10

Conversation

@bitfaster
Copy link
Copy Markdown
Owner

@bitfaster bitfaster commented Apr 16, 2026

Inlining GetAlternateLookup eliminates the heap allocation for the AlternateLookup struct on .NET 10:

Method Runtime Mean Ratio Gen0 Allocated
GetAlternateInline .NET 10.0 42.73 ns 0.77 - -
GetAlternateNoInline .NET 10.0 52.94 ns 0.96 0.0092 40 B
GetAlternateInline .NET 9.0 55.35 ns 1.00 0.0092 40 B
GetAlternateNoInline .NET 9.0 56.13 ns 1.01 0.0092 40 B

From https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-10/runtime

Inlining improvements

Various inlining improvements have been made in .NET 10.

The JIT can now inline methods that become eligible for devirtualization due to previous inlining. This improvement allows the JIT to uncover more optimization opportunities, such as further inlining and devirtualization.

...

Return types

During inlining, the JIT now updates the type of temporary variables that hold return values. If all return sites in a callee yield the same type, this precise type information is used to devirtualize subsequent calls. This enhancement complements the improvements in late devirtualization and array enumeration de-abstraction.

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 16, 2026

Coverage Status

coverage: 99.066% (-0.04%) from 99.11% — users/alexpeck/inline10 into main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants