mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 18:25:13 +08:00
Rename the DatabaseSync and StatementSync classes to Database and Statement, and the internal DatabaseSyncLimits helper to DatabaseLimits. The old names are kept as aliases of the new classes and are Documentation-only deprecated (DEP0210, DEP0211). Assisted-by: Claude Code Signed-off-by: Guilherme Araújo <arauujogui@gmail.com> PR-URL: https://github.com/nodejs/node/pull/65988 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
32 lines
652 B
JavaScript
32 lines
652 B
JavaScript
'use strict';
|
|
const common = require('../common.js');
|
|
const sqlite = require('node:sqlite');
|
|
const assert = require('assert');
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
n: [1e7],
|
|
transaction: ['true', 'false'],
|
|
});
|
|
|
|
function main(conf) {
|
|
const db = new sqlite.Database(':memory:');
|
|
|
|
if (conf.transaction === 'true') {
|
|
db.exec('BEGIN');
|
|
}
|
|
|
|
let i;
|
|
let deadCodeElimination;
|
|
|
|
bench.start();
|
|
for (i = 0; i < conf.n; i += 1)
|
|
deadCodeElimination = db.isTransaction;
|
|
bench.end(conf.n);
|
|
|
|
assert.strictEqual(deadCodeElimination, conf.transaction === 'true');
|
|
|
|
if (conf.transaction === 'true') {
|
|
db.exec('ROLLBACK');
|
|
}
|
|
}
|