dflake 1.0.2
Snowflake ID generator
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
dflake
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();
Performance
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.2 released 2 years ago
- andrewlalis/dflake
- MIT
- Copyright © 2022, Andrew Lalis
- Authors:
- Dependencies:
- none
- Versions:
-
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
-
9 downloads total
-
- Score:
- 0.8
- Short URL:
- dflake.dub.pm