Snowgen
Snowgen is a Rust-based library for generating unique, distributed IDs. It's inspired by Twitter's Snowflake ID generator and provides an efficient, thread-safe solution for generating unique IDs in distributed systems.
Features
- Customizable epoch, node ID, machine ID, and bit lengths for each component of the ID
- Thread-safe, ensuring unique IDs even in multi-threaded environments
- Builder pattern for easy configuration and validation
Getting Started
Add the following line to your Cargo.toml file under [dependencies]:
= "0.1.0"
Usage
use ;
Benchmark Results
single_thread_snowgen time: [243.83 ns 244.11 ns 244.41 ns]
change: [-0.3326% -0.0319% +0.2692%] (p = 0.84 > 0.05)
No change in performance detected.
Found 4 outliers among 100 measurements (4.00%)
1 (1.00%) low severe
3 (3.00%) low mild
multi_thread_snowgen time: [52.552 µs 52.991 µs 53.352 µs]
change: [-0.8495% -0.0131% +0.7323%] (p = 0.98 > 0.05)
No change in performance detected.
Found 5 outliers among 100 measurements (5.00%)
2 (2.00%) low severe
2 (2.00%) high mild
License
This project is licensed under the License.