INNER CODE UNIT · JavaScript

async

m4heshd/better-sqlite3-multiple-ciphers · benchmark/benchmark.js:9

const async = (fn) => {
	const wrapped = cb => fn().then(() => cb(), cb);
	benchmark(wrapped).then(display);
};

const display = (result) => {
	process.stdout.write(String(result).replace(/ \(.*/, ''));
	process.exit();
};

(async () => {
	process.on('unhandledRejection', (err) => { throw err; });
	const ctx = JSON.parse(process.argv[2]);
	const type = require(`./types/${ctx.type}`);
	const db = await require('./drivers').get(ctx.driver)('../temp/benchmark.db', ctx.pragma);
	if (!type.readonly) {
		for (const table of ctx.tables) await db.exec(`DELETE FROM ${table} WHERE rowid > 1;`);
		await db.exec('VACUUM;');

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…