A .NET Standard 2.0 library to create UUIDv7-style Guids.
Example:
namespace UUIDv7.Console;
using static System.Console;
using static Uuid7;
public static class Program
{
public static void Main()
{
WriteLine(UnixEpoch);
WriteLine(UnixEpochMax);
for (int i = 0; i < 20; i++)
{
WriteLine(Create());
}
WriteLine();
DateTimeOffset offset = DateTimeOffset.UtcNow;
for (int i = 0; i < 20; i++)
{
WriteLine(Create(offset));
}
}
}
BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 7763 2.62GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.301
[Host] : .NET 10.0.9 (10.0.9, 10.0.926.27113), X64 RyuJIT x86-64-v3
DefaultJob : .NET 10.0.9 (10.0.9, 10.0.926.27113), X64 RyuJIT x86-64-v3
| Method | PayloadLength | Mean | Error | StdDev |
|---|---|---|---|---|
| BenchmarkMethod | 1000 | 660.4 μs | 3.25 μs | 2.88 μs |
| BenchmarkMethod | 10000 | 6,798.6 μs | 6.43 μs | 5.70 μs |
| BenchmarkMethod | 100000 | 65,599.2 μs | 97.32 μs | 86.27 μs |
| BenchmarkMethod | 1000000 | 654,985.5 μs | 752.81 μs | 667.35 μs |