| Crates.io | re_tuid |
| lib.rs | re_tuid |
| version | 0.25.1 |
| created_at | 2023-02-12 16:22:10.972204+00 |
| updated_at | 2025-09-19 08:55:59.806845+00 |
| description | 128-bit Time-based Unique Identifier |
| homepage | https://rerun.io |
| repository | https://github.com/rerun-io/rerun |
| max_upload_size | |
| id | 783296 |
| size | 55,745 |
Part of the rerun family of crates.
TUID:s are 128-bit identifiers, that have a global time-based order, with tie-breaking between threads. This means you can use a TUID as a tie-breaker in time series databases.
TUID is based on two fields, both of which are monotonically increasing:
time_ns: u64inc: u64time_ns is an approximate nanoseconds since unix epoch. It is monotonically increasing, though two TUID:s generated closely together may get the same time_ns.
inc is a monotonically increasing integer, initialized to some random number on each thread.
So the algorithm is this:
incinctime_nsTUID { time_ns, inc }On a single core of a 2022 M1 MacBook we can generate 40 million TUID/s, which is 25 ns per TUID.
For time-based exploits (like Meltdown/Spectre) time_ns should probably be rounded to nearest millisecond for sensitive systems. The last ~20 bits of time_ns can be filled with more randomness to lessen the chance of collisions.