Snowflake ID generator
To use this package, run the following command in your project's root directory:
Put the following dependency into your project's dependences section:
Snowflake ID implementation for the D language, for generating increasing, unique ids, without the need for synchronization of distributed systems.
import dflake; auto gen = SnowflakeGenerator(123); long id = gen.nextId();
Each individual generator can produce ids in a sequential, thread-safe manner. You can clone this project and run
dub test to run the test suite which includes some performance tests.
On my machine (AMD Ryzen Threadripper 2920X 12-Core Processor), I have benchmarked it at generating slightly more than 4,000,000 ids per second.
Inspired by a Java implementation by callicoder.
For more information about the Snowflake ID concept, read Twitter's blog post.
- Registered by Andrew Lalis
- 1.0.1 released a year ago
- Copyright © 2022, Andrew Lalis
1.0.2 2022-Jun-06 1.0.1 2022-May-25 1.0.0 2022-May-25 ~main 2022-Jun-06
- Download Stats:
0 downloads today
0 downloads this week
0 downloads this month
5 downloads total
- Short URL: