Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[XamlC] Cache Resolve and ImportReference #1875

Merged
merged 1 commit into from
Feb 13, 2018
Merged

Conversation

StephaneDelcroix
Copy link
Member

@StephaneDelcroix StephaneDelcroix commented Feb 13, 2018

Description of Change

[XamlC] Cache Resolve and ImportReference

ImportReference with System.Reflection based argument is notoriously
slow on .NET. So we cache the results for those.

We do not cache the results for TypeReference, MethodReference or
FieldReference calls, as those are already fast (passthrough if the
reference was already imported), and they aren't valid as dictionary
keys (no concept of equatability).

While we're at it, we shave another few ms from Resolve(TypeReference)
calls as well.

As, on good days, it shaves up to 40% of XamlC time, we can say that it fixes #1848

Bugs Fixed

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Consolidate commits as makes sense

ImportReference with System.Reflection based argument is notoriously
slow on .NET. So we cache the results for those.

We do not cache the results for TypeReference, MethodReference or
FieldReference calls, as those are already fast (passthrough if the
reference was already imported), and they aren't valid as dictionary
keys (no concept of equatability).

While we're at it, we shave another few ms from Resolve(TypeReference)
calls as well.

As, on good days, it shaves up to 40% of XamlC time, we can say that it

 - fixes #1848
@jassmith
Copy link

1>      167 ms  ResolveAssemblyReference                   1 calls
1>      171 ms  GenerateDepsFile                           1 calls
1>      205 ms  JoinItems                                  8 calls
1>      267 ms  XamlCTask                                  1 calls
1>     1434 ms  Csc                                        1 calls

Seeeems good

@StephaneDelcroix StephaneDelcroix merged commit af6f333 into master Feb 13, 2018
@StephaneDelcroix StephaneDelcroix deleted the faster-xamlc branch February 13, 2018 21:27
@samhouts samhouts added this to the 3.0.0 milestone May 5, 2018
@samhouts samhouts modified the milestones: 3.0.0, 2.5.0 Aug 23, 2019
@samhouts samhouts modified the milestones: 3.0.0, 2.5.0 Oct 29, 2019
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.

Improve XAMLC Compilation performance
3 participants