Skip to content

Source Gen: reuse generated invokables - #8749

Merged
ReubenBond merged 5 commits into
dotnet:mainfrom
ReubenBond:codegen/min-invokers
Dec 1, 2023
Merged

ReubenBond merged 5 commits into
dotnet:mainfrom
ReubenBond:codegen/min-invokers

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Nov 29, 2023 •

Copy link
Copy Markdown
Member

Currently, if we have these interfaces:

interface IMyGrainA : IGrain
{
  Task A();
}
interface IMyGrainB : IGrain
{
  Task B();
}
interface IMyGrainC : IMyGrainA, IMyGrainB
{
  Task C();
}

We will generate 5 invokers:

  • 3 necessary: IMyGrainA.A(), IMyGrainB.B(), IMyGrainC.C()
  • 2 unnecessary: IMyGrainC.A(), IMyGrainC.B()

This PR avoids generating the unnecessary ones, instead reusing the invokers for the inherited interfaces (IMyGrainA & IMyGrainB) for the GrainReference generated for IMyGrainC.

EDIT: as a happy aside, this also improves Orleans build performance slightly:
Old:
image
New:
image

Microsoft Reviewers: Open in CodeFlow

@ReubenBond
ReubenBond merged commit e751b58 into dotnet:main Dec 1, 2023
@ReubenBond
ReubenBond deleted the codegen/min-invokers branch December 1, 2023 15:51
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants