MCPcopy Index your code
hub / github.com/nodejs/node / main

Function main

benchmark/sqlite/sqlite-prepare-select-get-options.js:15–50  ·  view source on GitHub ↗
(conf)

Source from the content-addressed store, hash-verified

13});
14
15function main(conf) {
16 const optionsObj = conf.options === 'none' ? {} : conf.options.split('|').reduce((acc, key) => {
17 acc[key] = true;
18 return acc;
19 }, {});
20
21 const db = new sqlite.DatabaseSync(':memory:', optionsObj);
22
23 db.exec(
24 'CREATE TABLE foo (text_column TEXT, integer_column INTEGER, real_column REAL, blob_column BLOB)',
25 );
26
27 const fooInsertStatement = db.prepare(
28 'INSERT INTO foo (text_column, integer_column, real_column, blob_column) VALUES (?, ?, ?, ?)',
29 );
30
31 for (let i = 0; i < conf.tableSeedSize; i++) {
32 fooInsertStatement.run(
33 crypto.randomUUID(),
34 Math.floor(Math.random() * 100),
35 Math.random(),
36 Buffer.from('example blob data'),
37 );
38 }
39
40 let i;
41 let deadCodeElimination;
42
43 const stmt = db.prepare(conf.statement);
44
45 bench.start();
46 for (i = 0; i < conf.n; i += 1) deadCodeElimination = stmt.get();
47 bench.end(conf.n);
48
49 assert.ok(deadCodeElimination !== undefined);
50}

Callers

nothing calls this directly

Calls 11

reduceMethod · 0.80
randomMethod · 0.80
getMethod · 0.65
splitMethod · 0.45
execMethod · 0.45
prepareMethod · 0.45
runMethod · 0.45
fromMethod · 0.45
startMethod · 0.45
endMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…