-
Notifications
You must be signed in to change notification settings - Fork 86
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
LazyMetadataWrapper not super performant #195
Comments
It's been a long time since I looked at this code, but it looks like
Have you confirmed that in fact the cost here is paid multiple times for the same type? I don't see us copying arrays as much as filtering and transforming them: vs-mef/src/Microsoft.VisualStudio.Composition/Reflection/TypeRef.cs Lines 104 to 106 in c3eef68
But as this includes a few linq extension methods in a row, I suspect this could be optimized. |
The performance problem is seen only when loading the MEF graph from a serialized file. Also, I was performing a lookup multiple times. Hence, I was reading the lazyImports.Where(t => t.Metadata.MyTypeProperty == inputType); Putting the // The metadata interface...
public interface ISomeMetadata
{
Type MyTypeProperty { get; }
Type OtherProperty { get; }
}
// And later I cache it:
private Dictionary<ISomeMetadata, Type> metadataCache; More detailsFor 179 imported
|
When querying attribute data - multiple times - for lazy imports, I see that a significant amount of time is spent In LazyMetadataWrapper.
Why the need to copy the arrays like that? What would be your recommendation here? Should the consumer cache the metadata?
The text was updated successfully, but these errors were encountered: