Fast-Id
Quickly generate tens of millions of IDs (maximum 75200000), either sequentially or randomly.
Installation
npm install fast-id --save
Usage
Sequentially
Sequentially generate ids from 1 to 100:
const ID = 100; const main = { let id; // Fetch the next id id = ; // 1 console; // Fetch the next id id = ; // 2 console;}; ;
Randomly
Randomly generate ids from 1 to 100:
const ID = 100 isRandom: true; const main = { let id; // Fetch the next id id = ; // a random id between 1 and 100 console; // Fetch the next id id = ; // a random id between 1 and 100 console;}; ;
Performance
1. Sequentially
Sequentially generating 10000000 ids takes less than 1 second.
const max = 10000000;max logging: true;
The result will be like below:
fast-id initialized. [max = 10000000, 0.738s]
2. Randomly
Randomly generating 10000000 ids takes less than 1.5 seconds.
const max = 10000000;max isRandom: true logging: true;
The result will be like below:
fast-id initialized. [max = 10000000, 1.321s]
License
Copyright (c) 2019, Owen Luke