Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does it compare with UUID v7 (C# GUID.CreateVersion7()) #85

Open
brmassa opened this issue Oct 23, 2024 · 1 comment
Open

How does it compare with UUID v7 (C# GUID.CreateVersion7()) #85

brmassa opened this issue Oct 23, 2024 · 1 comment

Comments

@brmassa
Copy link

brmassa commented Oct 23, 2024

I might be wrong, but from what I understand for the new UUID v7, the initial statements, only the first still true:

  • It isn't the most character efficient way of encoding 128 bits of randomness: no big change here
  • UUID v1/v2 is impractical in many environments, as it requires access to a unique, stable MAC address: v7 not not use MAC
  • UUID v3/v5 requires a unique seed and produces randomly distributed IDs, which can cause fragmentation in many data structures: UUIDv7 does not require it
  • UUID v4 provides no other information than randomness which can cause fragmentation in many data structures v7 includes a timestamp

I don't know the performance benchmarks.

@neuecc
Copy link
Member

neuecc commented Oct 28, 2024

In my personal opinion, I think it's best to use GUID.CreateVersion7() preferentially in .NET 9 and later.
There are problems with Ulid in terms of interoperability with Guid, and UUIDv7, which works with Guid, is personally the most ideal ID.
In terms of performance, the current implementation of CreateVersion7 is inferior to NewGuid because it generates a Guid and then fills in the Timestamp part.
However, this is probably not something to worry about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants