INNER CODE UNIT · TypeScript
benchmark
oomol-lab/open-connector · scripts/benchmark-sqlite-token-statements.ts:52
async function benchmark(filename: string, iterations: number, schema?: string): Promise<void> {
const database = new DatabaseSync(filename);
try {
if (schema) database.exec(schema);
// Match the runtime's WAL setting; in-memory SQLite reports "memory" instead.
database.exec("pragma journal_mode = wal;");
const baseline = new PreparePerCallTokenStore(database);
const reused = new SqliteRuntimeTokenStore(database);
for (let index = 0; index < tokenCount; index++) {
await reused.add({
id: `token-${index}`,
name: `Token ${index}`,
tokenHash: hashes[index],
allowedActions: ["github.*"],
blockedActions: ["github.delete_repository"],
allowedProxies: ["github"],
allowedConnections: ["example:work"],
createdAt: timestamps[0],