dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.26k stars 4.73k forks source link

Add UTF-8 match algorithm for FileSystemName? #25976

Closed JeremyKuhne closed 1 month ago

JeremyKuhne commented 6 years ago

A UTF-8 implementation of FileSystemName.MatchesSimpleExpression would allow matching Unix/Mac data without having to first convert to UTF-16. Something like this perhaps:

namespace System.IO.Enumeration
{
    // name is UTF-8
    public static bool MatchesSimpleExpression(ReadOnlySpan<char> expression, ReadOnlySpan<byte> name, bool ignoreCase = true);
}

This could potentially improve performance. We currently convert from UTF-8 into a temporary UTF-16 buffer on the stack- it may also be that improvements here don't register against the cost of I/O. https://github.com/dotnet/corefx/blob/master/src/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEntry.Unix.cs#L88-L103

If anyone has a particular interest in this they are welcome to try and implement. If we find there is, in fact, a measurable benefit we can look at making a formal API proposal at that point.

JeremyKuhne commented 4 years ago

Triage: We should wait for the UTF-8 string work to finish to finalize on what we do here.

dotnet-policy-service[bot] commented 2 months ago

Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.

This process is part of our issue cleanup automation.

dotnet-policy-service[bot] commented 1 month ago

This issue will now be closed since it had been marked no-recent-activity but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.