Refactor known folder GUIDs to use static properties#118165
Refactor known folder GUIDs to use static properties#118165jkotas merged 6 commits intodotnet:mainfrom
Conversation
…ants
internal const string ([a-z0-9]+) = "\{([a-z0-9]{8})-([a-z0-9]{4})-([a-z0-9]{4})-([a-z0-9]{2})([a-z0-9]{2})-([a-z0-9]{2})([a-z0-9]{2})([a-z0-9]{2})([a-z0-9]{2})([a-z0-9]{2})([a-z0-9]{2})\}";
internal static Guid $1 => new(0x$2, 0x$3, 0x$4, 0x$5, 0x$6, 0x$7, 0x$8, 0x$9, 0x$10, 0x$11, 0x$12);
2a9ad80 to
77f5d77
Compare
|
Is this expected to be a perf improvement? Do you have any numbers (for the public Environment APIs) to demonstrate that this is better? |
This comment has been minimized.
This comment has been minimized.
This was expected to be a performance improvement as it avoids the overhead of initialising a Guid from a string, see https://csharp.godbolt.org/z/vxKqKjT4r However |
|
How about code size metrics? Is this a binary size improvement, e.g. for NAOT? |
@EgorBo Could you help verify this? |
@MihaZupan These changes are specific to Windows target, is this an option with MihuBot? |
This comment was marked as outdated.
This comment was marked as outdated.
No, hasn't been wired through for the JIT diffs |
|
1kb is not that much and it is 4kB regression for non-NAOT ( Have you tried to actually step through the code to see where to make this better? I see:
|
src/libraries/Common/src/Interop/Windows/Shell32/Interop.SHGetKnownFolderPath.cs
Outdated
Show resolved
Hide resolved
This comment was marked as outdated.
This comment was marked as outdated.
I do not expect that this ReadOnlySpan change is going improve throughput over the previous version. It is code size improvement. You may see some throughput improvement if you get rid of Enum.IsDefined calls. |
src/libraries/System.Private.CoreLib/src/System/Environment.Win32.cs
Outdated
Show resolved
Hide resolved
…n32.cs Co-authored-by: Jan Kotas <[email protected]>
This comment has been minimized.
This comment has been minimized.
src/libraries/Common/src/Interop/Windows/Shell32/Interop.SHGetKnownFolderPath.cs
Show resolved
Hide resolved
|
@EgorBo There is no correctness issue for big-endian platforms, since we call Guid(ReadOnlySpan). Using |
|
4kb-5kB improvement for NAOT MichalStrehovsky/rt-sz#159 (comment) |
The following regular expression was used:
internal const string ([a-z0-9]+) = "\{([a-z0-9]{8})-([a-z0-9]{4})-([a-z0-9]{4})-([a-z0-9]{2})([a-z0-9]{2})-([a-z0-9]{2})([a-z0-9]{2})([a-z0-9]{2})([a-z0-9]{2})([a-z0-9]{2})([a-z0-9]{2})\}";internal static Guid $1 => new(0x$2, 0x$3, 0x$4, 0x$5, 0x$6, 0x$7, 0x$8, 0x$9, 0x$10, 0x$11, 0x$12);