auto commit
This commit is contained in:
@@ -12,7 +12,7 @@ namespace Yitter.OrgSystem.TestA
|
||||
class Program
|
||||
{
|
||||
// 测试参数(默认配置下,最佳性能是10W/s)
|
||||
static int genIdCount = 2;//5000; // 计算ID数量(如果要验证50W效率,请将TopOverCostCount设置为20000或适当增加SeqBitLength)
|
||||
static int genIdCount = 500000;//5000; // 计算ID数量(如果要验证50W效率,请将TopOverCostCount设置为2000或适当增加SeqBitLength)
|
||||
static short method = 1; // 1-漂移算法,2-传统算法
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ namespace Yitter.OrgSystem.TestA
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
RunSingle();
|
||||
return;
|
||||
|
||||
Console.WriteLine("Hello World! C#");
|
||||
|
||||
var options = new IdGeneratorOptions()
|
||||
@@ -130,16 +133,42 @@ namespace Yitter.OrgSystem.TestA
|
||||
|
||||
private static void RunSingle()
|
||||
{
|
||||
DateTime start = DateTime.Now;
|
||||
|
||||
for (int i = 0; i < genIdCount; i++)
|
||||
var options = new IdGeneratorOptions()
|
||||
{
|
||||
var id = IdGen.NewLong();
|
||||
}
|
||||
Method = 1,
|
||||
WorkerId = 1,
|
||||
|
||||
DateTime end = DateTime.Now;
|
||||
Console.WriteLine($"++++++++++++++++++++++++++++++++++++++++, total: {(end - start).TotalMilliseconds} ms");
|
||||
Interlocked.Increment(ref Program.Count);
|
||||
//WorkerIdBitLength = 6,
|
||||
SeqBitLength = 6,
|
||||
|
||||
//DataCenterIdBitLength = 0,
|
||||
//TopOverCostCount = 2000,
|
||||
|
||||
//TimestampType = 1,
|
||||
// MinSeqNumber = 1,
|
||||
// MaxSeqNumber = 200,
|
||||
// BaseTime = DateTime.Now.AddYears(-10),
|
||||
};
|
||||
|
||||
//IdGen = new DefaultIdGenerator(options);
|
||||
YitIdHelper.SetIdGenerator(options);
|
||||
|
||||
while (true)
|
||||
{
|
||||
DateTime start = DateTime.Now;
|
||||
|
||||
for (int i = 0; i < genIdCount; i++)
|
||||
{
|
||||
//var id = IdGen.NewLong();
|
||||
var id = YitIdHelper.NextId();
|
||||
}
|
||||
|
||||
DateTime end = DateTime.Now;
|
||||
Console.WriteLine($"++++++++++++++++++++++++++++++++++++++++, total: {(end - start).TotalMilliseconds} ms");
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
//Interlocked.Increment(ref Program.Count);
|
||||
}
|
||||
|
||||
private static void Go(IdGeneratorOptions options)
|
||||
|
||||
Reference in New Issue
Block a user