A .NET Standard 2.0 port of Segment's implementation of K-Sortable Unique IDentifiers(KSUID). You can use this instead of GUID's where you can take advantage of it's
- Natural ordering by generation time
- Collision-free, coordination-free & dependency-free nature
- Highly portable representation
To install from NuGet with dotnet
CLI, use following command
dotnet add package DotKsuid --version 1.0.0
To create a new KSUID
var ksuid = Ksuid.NewKsuid();
To convert a KSUID to it's base62 encoded string representation
var ksuidString = Ksuid.NewKsuid().ToString();
While this can't achieve the same performance as framework supported GUID's (since they are generated by calling native OS methods), it is written to be as fast as possible. Below is a benchmark result from the included Benchmarks project aganist GUID's
Screenshot 2021-06-18 at 10.14.40 PM
Below is a benchmark aganist the only other port of KSUID's available currently for .NET (tagged as "Ksuids" & "KsuidString").
Screenshot 2021-06-18 at 10.22.04 PM
As you can see this solution has a vastly improved performance compared to other existing implementations.