Skip to content

Commit

Permalink
add BaseUid comparison table
Browse files Browse the repository at this point in the history
  • Loading branch information
soc committed Dec 30, 2024
1 parent e180038 commit d1be97e
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions _standards/base-uid.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ markdeep: true

- Compact
20 characters encode 120 bits of payload.
- Efficient
Speedy encoding and decoding.
- Compatible
Can be used in URLs, form-fields and as HTML attributes.
- Convenient
- Lexicographically ordered
The bitstring and the encoded string sort the same.
- Database-friendly
Time-prefix improves database locality and performance.
- Efficient
Makes most out of the available bits.

### Structure of a BaseUid

Expand Down Expand Up @@ -57,4 +57,23 @@ These two parts are concatenated into a 120bit long bitstring ...

### Comparison with other UID formats

(todo → get list from https://datatracker.ietf.org/doc/html/draft-ietf-uuidrev-rfc4122bis#section-2.1)
| | Payload | Compact | Efficient | Compatible | Ordered | Database-friendly |
|------------------------------------------------------------------------------------------|--------:|-------------------|:---------:|:----------:|:-------:|:-----------------:|
| BaseUID | 120bits | ✔ Base64 |||||
| UUID text repr. | 128bits | ✖ Base16 |||||
| [ULID](https://github.com/ulid/spec) | 128bits | 🞈 Base32 | 🞈 ||||
| [LexicalUUID](https://github.com/twitter-archive/cassie) | 128bits | ✖ Base16 |||||
| [Flake](https://github.com/boundary/flake) | 128bits | ✔ Base62 |||||
| [ShardingID](https://instagram-engineering.com/sharding-ids-at-instagram-1cf5a71e5a5c) | 64bits | ✖ Base10 | 🞈 ||||
| [KSUID](https://github.com/segmentio/ksuid) | 160bits | ✔ Base62 |||||
| [Elasticflake](https://github.com/ppearcy/elasticflake) | 120bits | ✔ Base64 |||||
| [FlakeID](https://github.com/T-PWK/flake-idgen) | 64bits | ✖ Base10/16 |||||
| [Sonyflake](https://github.com/sony/sonyflake) | 64bits ||||||
| [orderedUuid](https://itnext.io/laravel-the-mysterious-ordered-uuid-29e7500b4f8) | 120bits | ✖ Base10 |||||
| [COMBGUID](https://github.com/richardtallent/RT.Comb) | 120bits | ✖ Base10 |||||
| [SID](https://github.com/chilts/sid) | 128bits | ✔ Base10/16/32/64 |||||
| [pushID](https://firebase.googleblog.com/2015/02/the-2120-ways-to-ensure-unique_68.html) | 120bits | ✔ Base64 |||||
| [XID](https://github.com/rs/xid) | 96bits | 🞈 Base32 |||||
| [ObjectID](https://docs.mongodb.com/manual/reference/method/ObjectId/) | 96bits | ✖ Base16 |||||
| [CUID](https://github.com/ericelliott/cuid) || ✖ Base36 |||||
{: .table-medium .table-layout-auto }

0 comments on commit d1be97e

Please sign in to comment.