Skip to content

Commit

Permalink
Move all projects into one...
Browse files Browse the repository at this point in the history
  • Loading branch information
Wsm2110 committed Apr 16, 2024
1 parent 9a535f7 commit 7cd3236
Show file tree
Hide file tree
Showing 38 changed files with 424 additions and 172 deletions.
66 changes: 22 additions & 44 deletions Faster.Map.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Faster.Map.Concurrent.Benchmark", "benchmarks\Faster.Map.Concurrent.Benchmark\Faster.Map.Concurrent.Benchmark.csproj", "{C6FEBDFE-354B-4333-8EA5-B4C306550BFE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Faster.Map.RobinhoodMap", "src\Faster.Map.RobinhoodMap\Faster.Map.RobinhoodMap.csproj", "{78E5F4CB-1A40-4E16-A253-1F49916F47EB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{21A59AB1-1ABE-404A-972E-21ECAE7DC24A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Faster.Map.QuadMap", "src\Faster.Map.QuadMap\Faster.Map.QuadMap.csproj", "{5F904DC8-30AC-4AE1-8EB0-5076BA2D2CA7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Faster.Map.DenseMap", "src\Faster.Map.DenseMap\Faster.Map.DenseMap.csproj", "{5FDBE8E7-2D1E-4F1C-8C34-E37A600D8C6C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Faster.Map.Core", "src\Faster.Map.Core\Faster.Map.Core.csproj", "{30C107C5-34AB-4CA6-8A59-3CF1D93F3545}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Faster.Map.DenseMap.Tests", "unittests\Faster.Map.DenseMap.Tests\Faster.Map.DenseMap.Tests.csproj", "{398DC6D2-90BE-4A0F-9CFA-DD728260B379}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Faster.Map.QuadMap.Tests", "unittests\Faster.Map.QuadMap.Tests\Faster.Map.QuadMap.Tests.csproj", "{023FBC3A-87FD-4789-9E3F-0DBE97BFE6D2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Faster.Map.RobinhoodMap.Tests", "unittests\Faster.Map.RobinhoodMap.Tests\Faster.Map.RobinhoodMap.Tests.csproj", "{C5F9A7E0-085D-4BA9-BD18-BDEDF987C35E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Faster.Map.Nuget.Tests", "unittests\Faster.Map.Nuget.Tests\Faster.Map.Nuget.Tests.csproj", "{9489C1F8-4BCC-407F-9B90-C4D2726F382E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Faster.Map", "src\Faster.Map\Faster.Map.csproj", "{6C8A8BB9-6DB6-4956-B203-BFF15E558AA5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -51,38 +47,6 @@ Global
{C6FEBDFE-354B-4333-8EA5-B4C306550BFE}.Release|Any CPU.Build.0 = Release|Any CPU
{C6FEBDFE-354B-4333-8EA5-B4C306550BFE}.Release|x86.ActiveCfg = Release|Any CPU
{C6FEBDFE-354B-4333-8EA5-B4C306550BFE}.Release|x86.Build.0 = Release|Any CPU
{78E5F4CB-1A40-4E16-A253-1F49916F47EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78E5F4CB-1A40-4E16-A253-1F49916F47EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78E5F4CB-1A40-4E16-A253-1F49916F47EB}.Debug|x86.ActiveCfg = Debug|Any CPU
{78E5F4CB-1A40-4E16-A253-1F49916F47EB}.Debug|x86.Build.0 = Debug|Any CPU
{78E5F4CB-1A40-4E16-A253-1F49916F47EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78E5F4CB-1A40-4E16-A253-1F49916F47EB}.Release|Any CPU.Build.0 = Release|Any CPU
{78E5F4CB-1A40-4E16-A253-1F49916F47EB}.Release|x86.ActiveCfg = Release|Any CPU
{78E5F4CB-1A40-4E16-A253-1F49916F47EB}.Release|x86.Build.0 = Release|Any CPU
{5F904DC8-30AC-4AE1-8EB0-5076BA2D2CA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5F904DC8-30AC-4AE1-8EB0-5076BA2D2CA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5F904DC8-30AC-4AE1-8EB0-5076BA2D2CA7}.Debug|x86.ActiveCfg = Debug|Any CPU
{5F904DC8-30AC-4AE1-8EB0-5076BA2D2CA7}.Debug|x86.Build.0 = Debug|Any CPU
{5F904DC8-30AC-4AE1-8EB0-5076BA2D2CA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5F904DC8-30AC-4AE1-8EB0-5076BA2D2CA7}.Release|Any CPU.Build.0 = Release|Any CPU
{5F904DC8-30AC-4AE1-8EB0-5076BA2D2CA7}.Release|x86.ActiveCfg = Release|Any CPU
{5F904DC8-30AC-4AE1-8EB0-5076BA2D2CA7}.Release|x86.Build.0 = Release|Any CPU
{5FDBE8E7-2D1E-4F1C-8C34-E37A600D8C6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FDBE8E7-2D1E-4F1C-8C34-E37A600D8C6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FDBE8E7-2D1E-4F1C-8C34-E37A600D8C6C}.Debug|x86.ActiveCfg = Debug|Any CPU
{5FDBE8E7-2D1E-4F1C-8C34-E37A600D8C6C}.Debug|x86.Build.0 = Debug|Any CPU
{5FDBE8E7-2D1E-4F1C-8C34-E37A600D8C6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FDBE8E7-2D1E-4F1C-8C34-E37A600D8C6C}.Release|Any CPU.Build.0 = Release|Any CPU
{5FDBE8E7-2D1E-4F1C-8C34-E37A600D8C6C}.Release|x86.ActiveCfg = Release|Any CPU
{5FDBE8E7-2D1E-4F1C-8C34-E37A600D8C6C}.Release|x86.Build.0 = Release|Any CPU
{30C107C5-34AB-4CA6-8A59-3CF1D93F3545}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30C107C5-34AB-4CA6-8A59-3CF1D93F3545}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30C107C5-34AB-4CA6-8A59-3CF1D93F3545}.Debug|x86.ActiveCfg = Debug|Any CPU
{30C107C5-34AB-4CA6-8A59-3CF1D93F3545}.Debug|x86.Build.0 = Debug|Any CPU
{30C107C5-34AB-4CA6-8A59-3CF1D93F3545}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30C107C5-34AB-4CA6-8A59-3CF1D93F3545}.Release|Any CPU.Build.0 = Release|Any CPU
{30C107C5-34AB-4CA6-8A59-3CF1D93F3545}.Release|x86.ActiveCfg = Release|Any CPU
{30C107C5-34AB-4CA6-8A59-3CF1D93F3545}.Release|x86.Build.0 = Release|Any CPU
{398DC6D2-90BE-4A0F-9CFA-DD728260B379}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{398DC6D2-90BE-4A0F-9CFA-DD728260B379}.Debug|Any CPU.Build.0 = Debug|Any CPU
{398DC6D2-90BE-4A0F-9CFA-DD728260B379}.Debug|x86.ActiveCfg = Debug|x86
Expand All @@ -107,20 +71,34 @@ Global
{C5F9A7E0-085D-4BA9-BD18-BDEDF987C35E}.Release|Any CPU.Build.0 = Release|Any CPU
{C5F9A7E0-085D-4BA9-BD18-BDEDF987C35E}.Release|x86.ActiveCfg = Release|Any CPU
{C5F9A7E0-085D-4BA9-BD18-BDEDF987C35E}.Release|x86.Build.0 = Release|Any CPU
{9489C1F8-4BCC-407F-9B90-C4D2726F382E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9489C1F8-4BCC-407F-9B90-C4D2726F382E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9489C1F8-4BCC-407F-9B90-C4D2726F382E}.Debug|x86.ActiveCfg = Debug|Any CPU
{9489C1F8-4BCC-407F-9B90-C4D2726F382E}.Debug|x86.Build.0 = Debug|Any CPU
{9489C1F8-4BCC-407F-9B90-C4D2726F382E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9489C1F8-4BCC-407F-9B90-C4D2726F382E}.Release|Any CPU.Build.0 = Release|Any CPU
{9489C1F8-4BCC-407F-9B90-C4D2726F382E}.Release|x86.ActiveCfg = Release|Any CPU
{9489C1F8-4BCC-407F-9B90-C4D2726F382E}.Release|x86.Build.0 = Release|Any CPU
{6C8A8BB9-6DB6-4956-B203-BFF15E558AA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6C8A8BB9-6DB6-4956-B203-BFF15E558AA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C8A8BB9-6DB6-4956-B203-BFF15E558AA5}.Debug|x86.ActiveCfg = Debug|Any CPU
{6C8A8BB9-6DB6-4956-B203-BFF15E558AA5}.Debug|x86.Build.0 = Debug|Any CPU
{6C8A8BB9-6DB6-4956-B203-BFF15E558AA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C8A8BB9-6DB6-4956-B203-BFF15E558AA5}.Release|Any CPU.Build.0 = Release|Any CPU
{6C8A8BB9-6DB6-4956-B203-BFF15E558AA5}.Release|x86.ActiveCfg = Release|Any CPU
{6C8A8BB9-6DB6-4956-B203-BFF15E558AA5}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1643EE6A-F080-49DE-817E-C0698BDCA3C6} = {717F512C-A5FC-4B01-9532-17D2663884A0}
{C6FEBDFE-354B-4333-8EA5-B4C306550BFE} = {717F512C-A5FC-4B01-9532-17D2663884A0}
{78E5F4CB-1A40-4E16-A253-1F49916F47EB} = {21A59AB1-1ABE-404A-972E-21ECAE7DC24A}
{5F904DC8-30AC-4AE1-8EB0-5076BA2D2CA7} = {21A59AB1-1ABE-404A-972E-21ECAE7DC24A}
{5FDBE8E7-2D1E-4F1C-8C34-E37A600D8C6C} = {21A59AB1-1ABE-404A-972E-21ECAE7DC24A}
{30C107C5-34AB-4CA6-8A59-3CF1D93F3545} = {21A59AB1-1ABE-404A-972E-21ECAE7DC24A}
{398DC6D2-90BE-4A0F-9CFA-DD728260B379} = {D14F1A94-1E12-40B7-95AD-458306CAC233}
{023FBC3A-87FD-4789-9E3F-0DBE97BFE6D2} = {D14F1A94-1E12-40B7-95AD-458306CAC233}
{C5F9A7E0-085D-4BA9-BD18-BDEDF987C35E} = {D14F1A94-1E12-40B7-95AD-458306CAC233}
{9489C1F8-4BCC-407F-9B90-C4D2726F382E} = {D14F1A94-1E12-40B7-95AD-458306CAC233}
{6C8A8BB9-6DB6-4956-B203-BFF15E558AA5} = {21A59AB1-1ABE-404A-972E-21ECAE7DC24A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B844430C-F4DE-4B2B-BD01-0E455BD01E41}
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Faster.Map.Benchmark/AddAndResizeBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using BenchmarkDotNet.Attributes;
using Faster.Map.DenseMap;
using Faster.Map.QuadMap;
using Faster.Map.RobinhoodMap;
using Faster.Map.RobinHoodMap;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Faster.Map.Benchmark/AddBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.IO;
using BenchmarkDotNet.Attributes;
using Faster.Map.DenseMap;
using Faster.Map.RobinhoodMap;
using Faster.Map.RobinHoodMap;
using Faster.Map.QuadMap;

namespace Faster.Map.Benchmark
Expand Down
5 changes: 1 addition & 4 deletions benchmarks/Faster.Map.Benchmark/Faster.Map.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Faster.Map.Core\Faster.Map.Core.csproj" />
<ProjectReference Include="..\..\src\Faster.Map.DenseMap\Faster.Map.DenseMap.csproj" />
<ProjectReference Include="..\..\src\Faster.Map.QuadMap\Faster.Map.QuadMap.csproj" />
<ProjectReference Include="..\..\src\Faster.Map.RobinhoodMap\Faster.Map.RobinhoodMap.csproj" />
<ProjectReference Include="..\..\src\Faster.Map\Faster.Map.csproj" />
</ItemGroup>


Expand Down
21 changes: 13 additions & 8 deletions benchmarks/Faster.Map.Benchmark/GetBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.IO;
using Faster.Map.QuadMap;
using Faster.Map.DenseMap;
using Faster.Map.RobinhoodMap;
using Faster.Map.RobinHoodMap;
using System;

namespace Faster.Map.Benchmark
Expand All @@ -15,19 +15,19 @@ public class GetBenchmark
{
#region Fields

private DenseMap<uint, uint> _denseMap = new DenseMap<uint, uint>();
private Dictionary<uint, uint> _dictionary = new Dictionary<uint, uint>();
private RobinhoodMap<uint, uint> _robinHoodMap = new();
private QuadMap<uint, uint> _quadMap = new();
private DenseMap<uint, uint> _denseMap;
private Dictionary<uint, uint> _dictionary;
private RobinhoodMap<uint, uint> _robinHoodMap;
private QuadMap<uint, uint> _quadMap;

private uint[] keys;

#endregion

#region Properties

[Params(1, 10, 100, 1000, 10000, 100000, 1000000)]
public int Length { get; set; }
[Params(1, 10, 100, 1000 ,10000, 100000, 1000000)]
public uint Length { get; set; }

#endregion

Expand All @@ -37,6 +37,11 @@ public class GetBenchmark
[GlobalSetup]
public void Setup()
{
_denseMap = new DenseMap<uint, uint>(Length);
_dictionary = new Dictionary<uint, uint>((int)Length);
_robinHoodMap = new(Length);
_quadMap = new(Length);

var output = File.ReadAllText("Numbers.txt");
var splittedOutput = output.Split(',');

Expand Down Expand Up @@ -72,7 +77,7 @@ public void RobinhoodMap()
for (int i = 0; i < Length; ++i)
{
var key = keys[i];
_robinHoodMap.Get(key, out var _);
_robinHoodMap.Get(key, out var _);
}
}

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Faster.Map.Benchmark/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Program
{
static void Main(string[] args)
{
BenchmarkRunner.Run<StringWrapperBenchmark>();
BenchmarkRunner.Run<StringBenchmark>();
}
}
}
2 changes: 1 addition & 1 deletion benchmarks/Faster.Map.Benchmark/RemoveBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using BenchmarkDotNet.Attributes;
using Faster.Map.DenseMap;
using Faster.Map.QuadMap;
using Faster.Map.RobinhoodMap;
using Faster.Map.RobinHoodMap;
using Microsoft.Collections.Extensions;

namespace Faster.Map.Benchmark
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Faster.Map.Benchmark/StringBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using BenchmarkDotNet.Attributes;
using Faster.Map.DenseMap;
using Faster.Map.QuadMap;
using Faster.Map.RobinhoodMap;
using Faster.Map.RobinHoodMap;
using Microsoft.Collections.Extensions;
using System;
using System.Collections.Generic;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Faster.Map.Benchmark/StringWrapperBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Faster.Map.Core;
using Faster.Map.DenseMap;
using Faster.Map.QuadMap;
using Faster.Map.RobinhoodMap;
using Faster.Map.RobinHoodMap;
using System.Collections.Generic;
using System.IO;

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Faster.Map.Benchmark/UpdateBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using BenchmarkDotNet.Attributes;
using Faster.Map.DenseMap;
using Faster.Map.QuadMap;
using Faster.Map.RobinhoodMap;
using Faster.Map.RobinHoodMap;
using Microsoft.Collections.Extensions;

namespace Faster.Map.Benchmark
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Faster.Map.DenseMap.csproj" />
<ProjectReference Include="..\..\src\Faster.Map\Faster.Map.csproj" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions src/Faster.Map.Core/Faster.Map.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>5.0.4</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
64 changes: 64 additions & 0 deletions src/Faster.Map.Nuget/Faster.Map.Nuget.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>false</ImplicitUsings>
<Nullable>disable</Nullable>
<LangVersion>preview</LangVersion>
<TargetFrameworks>net8.0</TargetFrameworks>
<LangVersion>Latest</LangVersion>
<Authors>Wiljan Ruizendaal</Authors>
<PackageReleaseNotes>
Add robinhood hashmap and quadratic hashmap
</PackageReleaseNotes>
<PackageProjectUrl>https://github.com/Wsm2110/Faster.Map</PackageProjectUrl>
<AssemblyVersion>5.0.4</AssemblyVersion>
<FileVersion>5.0.4</FileVersion>
<Title>Fastest .net hashmap</Title>
<Version>5.0.4</Version>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Description>Cutting-edge NuGet package offering high-performance hash map implementations leveraging SIMD (Single Instruction, Multiple Data) instructions. This innovative library combines the efficiency of SIMD operations with advanced hashing techniques </Description>
<RepositoryUrl>https://github.com/Wsm2110/Faster.Map</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>Hashmap Hashtable Dictionary Faster.map performance, simd, robinhood hashing, swisstable, absl</PackageTags>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Faster.Map.Core\Faster.Map.Core.csproj">
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
<IncludeAssets>Faster.Map.Core.dll</IncludeAssets>
</ProjectReference>
<ProjectReference Include="..\Faster.Map.DenseMap\Faster.Map.DenseMap.csproj">
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
<IncludeAssets>Faster.Map.DenseMap.dll</IncludeAssets>
</ProjectReference>
<ProjectReference Include="..\Faster.Map.QuadMap\Faster.Map.QuadMap.csproj">
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
<IncludeAssets>Faster.Map.QuadMap.dll</IncludeAssets>
</ProjectReference>
<ProjectReference Include="..\Faster.Map.RobinhoodMap\Faster.Map.RobinhoodMap.csproj" >
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
<IncludeAssets>Faster.Map.RobinhoodMap.dll</IncludeAssets>
</ProjectReference>

</ItemGroup>

<PropertyGroup>
<EmbedAllSources>True</EmbedAllSources>
<DebugType>embedded</DebugType>
</PropertyGroup>

<PropertyGroup>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<PackageId>Faster.Map</PackageId>
</PropertyGroup>

<ItemGroup>
<None Update="../README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>



</Project>
13 changes: 0 additions & 13 deletions src/Faster.Map.QuadMap/Faster.Map.QuadMap.csproj

This file was deleted.

17 changes: 0 additions & 17 deletions src/Faster.Map.RobinhoodMap/Faster.Map.RobinhoodMap.csproj

This file was deleted.

40 changes: 40 additions & 0 deletions src/Faster.Map/Core/StringWrapper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
using System.IO.Hashing;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

namespace Faster.Map.Core
{

public record struct StringWrapper: IEquatable<StringWrapper>
{
int hashcode;
public string Unwrapped { get; set; }

public StringWrapper(string unwrapped)
{
Unwrapped = unwrapped;

var span = unwrapped.AsSpan();
var result = XxHash3.HashToUInt64(MemoryMarshal.AsBytes(span)) >> 32;
hashcode = Unsafe.As<ulong, int>(ref result);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode()
{
return hashcode;
}

public static implicit operator string(StringWrapper source)
{
return source.Unwrapped;
}

public static implicit operator StringWrapper(string source)
{
return new StringWrapper(source);
}

}
}
Loading

0 comments on commit 7cd3236

Please sign in to comment.