Skip to content
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

CreateObject microbenchmark optimizations #1010

Merged
merged 6 commits into from
Oct 11, 2021

Conversation

manodasanW
Copy link
Member

I did a benchmark against some scenarios which end up calling our CreateObject code path multiple times. Based on what I saw there, did some microbenchmark optimizations as this is a core code path used many times where costs can add up. In addition, I ran the rosyln code analyzer and did any changes that looked like it can impact perf or memory.

  • Updating benchmark project versions and getting it working again for .NET native
  • Every CreateObject calls ends up creating a couple of IObjectReference objects based on QIs and so on. Made some changes to avoid some unnecessary ones.
  • The .GUID calls kept showing up on the ETW traces as being some cost as they look to use GetCustomAttributes internally. Hard coded the GUID of some of the ones we use in WinRT.Runtime. The IID optimizer could also help in some of these scnarios once we enable it for WinRT.Runtime, but these particular ones wouldn't really get optimized as .As or .TryAs were the ones doing the GetIID call.
  • Made changes to allow for inlining of some exception functions which are called frequently
  • Moved dispose func to local functions as it avoids a heap allocation for the func and was recommended by the rosyln analyzer

@manodasanW manodasanW force-pushed the manodasanw/CreateObjectOptimizations branch from 9b1fa9a to 14304d9 Compare October 6, 2021 18:35
Copy link
Member

@Scottj1s Scottj1s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, subject to new Guid(...)

@manodasanW manodasanW merged commit a32c457 into master Oct 11, 2021
@manodasanW manodasanW deleted the manodasanw/CreateObjectOptimizations branch October 11, 2021 03:13
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.

4 participants