-
Notifications
You must be signed in to change notification settings - Fork 269
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
perf: reduce allocations and calls to ToArray #2747
Conversation
@@ -272,7 +272,7 @@ protected IEnumerable<string> Deploy(IList<DeploymentItem> deploymentItems, stri | |||
/// <param name="isDirectory">Is this a directory.</param> | |||
/// <returns>Paths to items to deploy.</returns> | |||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Requirement is to handle all kinds of user exceptions and message appropriately.")] | |||
protected string[]? GetFullPathToFilesCorrespondingToDeploymentItem(DeploymentItem deploymentItem, string testSource, string resultsDirectory, IList<string> warnings, out bool isDirectory) | |||
protected List<string>? GetFullPathToFilesCorrespondingToDeploymentItem(DeploymentItem deploymentItem, string testSource, string resultsDirectory, IList<string> warnings, out bool isDirectory) |
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.
IList/IReadOnlyList?
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.
This is only internal/private stuff so I prefer to always be as specific as possible.
#endif | ||
} | ||
|
||
#if NETFRAMEWORK | ||
internal static object[] GetCustomAttributes(Assembly assembly, Type type) | ||
internal static List<Attribute> GetCustomAttributes(Assembly assembly, Type type) |
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.
ditto
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.
A profiling before/after could be interesting
I get the intent here, for stuff like ToArray().Length == 1, but for example the change in src/Adapter/MSTest.TestAdapter/Execution/TypeCache.cs makes the api pretty jagged, where some parts return ICollection and some return IEnumerable, just because some items need filtering and some don't. In most cases we will enumerate the collection eventually, so is there that much work that we are saving by not putting it in array or some other ICollection? |
No description provided.