-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
30 lines (28 loc) · 918 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Diagnostics;
using System.Threading.Tasks;
namespace Discogs.Dump.Playground
{
static class Program
{
static async Task BenchmarkDumpFetching()
{
using var dumpFetcher = new DumpFetcher();
var stream = dumpFetcher.GetLatestReleasesDumpStream();
var sw = Stopwatch.StartNew();
var cnt = 0;
await foreach (var _ in stream)
{
cnt++;
if (cnt % 10000 != 0 || sw.ElapsedMilliseconds < 1000) continue;
var speed = (int) (cnt / sw.Elapsed.TotalSeconds);
Console.WriteLine($"{cnt} records fetched, {speed} per second in average");
}
Console.WriteLine($"{(int) sw.Elapsed.TotalSeconds}s elapsed");
}
static async Task Main()
{
await BenchmarkDumpFetching();
}
}
}