We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 62da973 commit e6446d2Copy full SHA for e6446d2
benchmark/sqlite/sqlite-is-transaction.js
@@ -0,0 +1,33 @@
1
+'use strict';
2
+const common = require('../common.js');
3
+const sqlite = require('node:sqlite');
4
+const assert = require('assert');
5
+
6
+const bench = common.createBenchmark(main, {
7
+ n: [1e7],
8
+ transaction: ['true', 'false'],
9
+});
10
11
+function main(conf) {
12
+ const n = conf.n | 0;
13
14
+ const db = new sqlite.DatabaseSync(':memory:');
15
16
+ if (conf.transaction === 'true') {
17
+ db.exec('BEGIN');
18
+ }
19
20
+ let i;
21
+ let deadCodeElimination;
22
23
+ bench.start();
24
+ for (i = 0; i < n; i += 1)
25
+ deadCodeElimination = db.isTransaction;
26
+ bench.end(n);
27
28
+ assert.ok(deadCodeElimination === (conf.transaction === 'true'));
29
30
31
+ db.exec('ROLLBACK');
32
33
+}
0 commit comments