-
Notifications
You must be signed in to change notification settings - Fork 694
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
Use ReadOnlyMemory when calculating the related file extensions #5943
Conversation
return relatedFileExtensionsProperty; | ||
} | ||
|
||
static bool ReadOnlyMemoryEquals(ReadOnlyMemory<char> x, ReadOnlyMemory<char> y) |
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.
Is it worth making this an extension method that the whole repo can use?
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.
Sorry, I had merged before this.
I think we could eventually.
You were thinking a build/shared type of method?
@@ -50,6 +52,7 @@ public void Load(IEnumerable<string> paths) | |||
} | |||
} | |||
|
|||
[Obsolete("Unused and will be removed in a future version.")] |
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 seems to be used in the dotnet/sdk: dotnet/sdk#42458 (comment)
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.
2 options for you.
- Supress the warning
- Move to PopulateItemGroups
I'll revert the obsolete attribute for now.
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.
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.
Thanks. I think moving to PopulateItemGroups is the right approach going forward.
private List<Asset> _assets; | ||
private ConcurrentDictionary<string, string> _assemblyRelatedExtensions; | ||
private Dictionary<ReadOnlyMemory<char>, string> _assemblyRelatedExtensions; |
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.
@nkolev92 the SDK PR is now failing with this error in multiple tests, I wonder if it is related to this change:
C:\h\w\AADF0A48\p\d\sdk\9.0.100-ci\NuGet.targets(180,5): error : Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
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.
Weird, this codepath isn't run concurrently.
Bug
Related: NuGet/Home#12728
Description
This gets us about 4MB on OrchardCore.
We just use span instead of optimistically using substring.
Note that this calculation is cached on a per package level already.
This probably isn't perfect, but it's a start.
Before:
After:
In microbenchmarks, it registers about the same, but we can also notice that it's faster.
Before:
After:
PR Checklist