Skip to content

Commit

Permalink
Reduce string allocations in Path-related calls (#1600)
Browse files Browse the repository at this point in the history
* Reduce string allocations in Path-related calls

* Fix for netstandard2.0
  • Loading branch information
Youssef1313 authored Aug 4, 2023
1 parent d0bc895 commit de73429
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Core/Silk.NET.Core/Loader/DefaultPathResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,12 @@ out string? depsResolvedPath
foreach (var runtimeLib in defaultContext.RuntimeLibraries)
foreach (var nativeAsset in runtimeLib.GetRuntimeNativeAssets(defaultContext, rid))
{
#if NETSTANDARD2_0
if (Path.GetFileName(nativeAsset) == name || Path.GetFileNameWithoutExtension(nativeAsset) == name)
#else
var nativeAssetSpan = nativeAsset.AsSpan();
if (Path.GetFileName(nativeAssetSpan) == name || Path.GetFileNameWithoutExtension(nativeAssetSpan) == name)
#endif
{
appLocalNativePath = Path.Combine
(
Expand Down

0 comments on commit de73429

Please sign in to comment.