cherry-id
v0.0.5
Published
<!-- * @Description: * @author: bubao * @Date: 2021-06-07 14:44:04 * @LastEditors: bubao * @LastEditTime: 2021-06-29 13:26:03 -->
Readme
🌸 cherry-id
Introduction
The core algorithm copyright belongs to yitter
more:https://github.com/yitter/IdGenerator
USing cherry-id
npm i cherry-idconst GenId = require('cherry-id');
const genid = new GenId({ WorkerId: (process.argv[2] || 1) - 0 });
(() => {
console.time("Test Run");
const HSet = new Set();
for (let index = 0; index < 500000; index++) {
HSet.add(genid.NextId());
}
console.timeEnd("Test Run");
console.log([...HSet.values()].join("\n"))
console.log(HSet.size);
})();