step := 200000
fmt.Println("start")
t := utils.LocalMilliscond()
for i := 0; i < step; i++ {
idgen.NextId()
}
fmt.Printf("check total cost %d ms\n", utils.LocalMilliscond()-t)
check total cost 2013 ms
IdGeneratorOptions options = new IdGeneratorOptions((short) 1);
YitIdHelper.setIdGenerator(options);
long start = System.currentTimeMillis();
for (int i = 0; i < 500000; i++) {
YitIdHelper.nextId();
}
long end = System.currentTimeMillis();
System.out.println(end - start); // 8004
var options = new IdGeneratorOptions(1);
YitIdHelper.SetIdGenerator(options);
Stopwatch sw = new Stopwatch();
for (int i = 0; i < 500000; i++)
{
//ShardingFactory.NextSnowId(); //0.15秒
//ShardingFactory.NextObjectId(); //0.2秒
YitIdHelper.NextId(); //8秒多
}
sw.Stop();
Console.WriteLine(sw.ElapsedMilliseconds);
public static void main(String[] args) {
var count = 0;
// mybatis-plus的雪花算法
final var sequence = new Sequence();
// yitter-idgenerator-spring-boot-starter
// final var options = new IdGeneratorOptions();
// options.TopOverCostCount = 500;
// options.Method = 2;
// final var id = new WFGIdGenerator(options);
// yitter-idgenerator
IdGeneratorOptions options = new IdGeneratorOptions((short)1);
YitIdHelper.setIdGenerator(options);
final var start = System.currentTimeMillis();
while (count < 3000000) {
count++;
// id.next();
// sequence.nextId();
YitIdHelper.nextId();
}
System.out.println(System.currentTimeMillis() - start);
}