forked from npgsql/npgsql
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCommit.cs
More file actions
34 lines (28 loc) · 729 Bytes
/
Commit.cs
File metadata and controls
34 lines (28 loc) · 729 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
34
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
// ReSharper disable AssignNullToNotNullAttribute.Global
namespace Npgsql.Benchmarks;
[Config(typeof(Config))]
public class Commit
{
readonly NpgsqlConnection _conn;
readonly NpgsqlCommand _cmd;
public Commit()
{
_conn = BenchmarkEnvironment.OpenConnection();
_cmd = new NpgsqlCommand("SELECT 1", _conn);
}
[Benchmark]
public void Basic()
{
var tx = _conn.BeginTransaction();
_cmd.ExecuteNonQuery();
tx.Commit();
}
class Config : ManualConfig
{
public Config()
=> AddColumn(StatisticColumn.OperationsPerSecond);
}
}