-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce allocations required to create a TransformNode #72375
Reduce allocations required to create a TransformNode #72375
Conversation
Instead of wrapping the user function and passing that into the TransformNode ctor, we instead give the option of passing in a flag to indicate whether the TransformNode should do the try/catch itself. I believe this will save about 0.5% in allocations in the RichCopyTest.CopyPlain speedometer test and will do a test insertion to validate, keeping this as a draft PR until validated.
@dotnet/roslyn-compiler -- ptal |
Any thoughts @chsienki ? |
throw new UserFunctionException(e); | ||
} | ||
} | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could get rid of the if/else and edit the when
on the catch so we don't catch if !_wrapUserFunc
I'd then renamed _wrapUserFunc
to just CatchAnalyzerExceptions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went ahead and made the modification to the when clause.
I can be convinced otherwise, but I think I'd prefer to keep the current name (_wrapUserFunc) as the existing _func name doesn't convey a relationship to analyzers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generators are analyzers too, we sort of use the terms interchangeably inside the compiler, but I also don't have strong feelings on the naming.
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Instead of wrapping the user function and passing that into the TransformNode ctor, we instead give the option of passing in a flag to indicate whether the TransformNode should do the try/catch itself.
This looks to save about 0.5% in allocations in the RichCopyTest.CopyPlain speedometer via results here from this test insertion.