forked from roji/Npgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadRows.cs
More file actions
33 lines (29 loc) · 786 Bytes
/
ReadRows.cs
File metadata and controls
33 lines (29 loc) · 786 Bytes
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
31
32
33
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
namespace Npgsql.Benchmarks
{
[MemoryDiagnoser]
public class ReadRows
{
[Params(1, 10, 100, 1000)]
public int NumRows { get; set; }
NpgsqlCommand Command { get; set; }
[GlobalSetup]
public void Setup()
{
var conn = BenchmarkEnvironment.OpenConnection();
Command = new NpgsqlCommand($"SELECT generate_series(1, {NumRows})", conn);
Command.Prepare();
}
[Benchmark]
public void Read()
{
using (var reader = Command.ExecuteReader())
while (reader.Read()) { }
}
}
}