Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

Implement a caching version of virtual method enumeration algorithm - #1439

Merged
MichalStrehovsky merged 2 commits into
dotnet:masterfrom
MichalStrehovsky:virtualEnum
Jun 28, 2016
Merged

MichalStrehovsky merged 2 commits into
dotnet:masterfrom
MichalStrehovsky:virtualEnum

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

When compiling hello world, computing virtual method overrides shows up as pretty hot. Turns out the slowdown is mostly caused by the enumeration being slow. I'm introducing a caching version of the algorithm.

This drops hello world compilation time from ~3.4 seconds to ~3.2 seconds (!).

Some notes:

  • Caching only the methods on definitions, not on instantiated types.
  • I'm not adding cache invalidation. Since I'm not caching methods on generic instantiations, this shouldn't explode too much.
  • We might get further benefit if we change IEnumerable<MethodDesc> to MethodDesc[] in the method signature, but I'm not sure we would want to do that.

@MichalStrehovsky

Copy link
Copy Markdown
Member Author

@davidwrighton PTAL

@davidwrighton

Copy link
Copy Markdown
Member

This change looks good, but if you're not removing the old code, you have to leave in place testing for the old along with the new.

@MichalStrehovsky
MichalStrehovsky merged commit 6725fc4 into dotnet:master Jun 28, 2016
@MichalStrehovsky
MichalStrehovsky deleted the virtualEnum branch June 28, 2016 23:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants