public async Task Test_Vector_Fast() { using (var db = await OpenTestPartitionAsync()) { var location = await GetCleanDirectory(db, "ranked_set"); var vector = new FdbRankedSet(location); await db.ReadWriteAsync(async (tr) => { await vector.OpenAsync(tr); await PrintRankedSet(vector, tr); }, this.Cancellation); Log(); var rnd = new Random(); var sw = Stopwatch.StartNew(); for (int i = 0; i < 100; i++) { Console.Write("\rInserting " + i); await db.ReadWriteAsync((tr) => vector.InsertAsync(tr, TuPack.EncodeKey(rnd.Next())), this.Cancellation); } sw.Stop(); Log("\rDone in {0:N3} sec", sw.Elapsed.TotalSeconds); await db.ReadAsync((tr) => PrintRankedSet(vector, tr), this.Cancellation); } }
public async Task Test_Vector_Fast() { using (var db = await OpenTestPartitionAsync()) { var location = await GetCleanDirectory(db, "ranked_set"); var vector = new FdbRankedSet(location); await db.ReadWriteAsync(async (tr) => { await vector.OpenAsync(tr); await PrintRankedSet(vector, tr); }, this.Cancellation); Console.WriteLine(); var rnd = new Random(); var sw = Stopwatch.StartNew(); for (int i = 0; i < 100; i++) { Console.Write("\rInserting " + i); await db.ReadWriteAsync((tr) => vector.InsertAsync(tr, FdbTuple.EncodeKey(rnd.Next())), this.Cancellation); } sw.Stop(); Console.WriteLine("\rDone in {0:N3} sec", sw.Elapsed.TotalSeconds); await db.ReadAsync((tr) => PrintRankedSet(vector, tr), this.Cancellation); } }
public async Task Test_Vector_Fast() { using (var db = await OpenTestPartitionAsync()) { var location = await GetCleanDirectory(db, "ranked_set"); var vector = new FdbRankedSet(location); await db.ReadWriteAsync(async (tr) => { await vector.OpenAsync(tr); await PrintRankedSet(vector, tr); }, this.Cancellation); var rnd = new Random(); for (int i = 0; i < 1000; i++) { await db.ReadWriteAsync((tr) => vector.InsertAsync(tr, FdbTuple.Pack(rnd.Next())), this.Cancellation); } await db.ReadAsync((tr) => PrintRankedSet(vector, tr), this.Cancellation); } }