MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / seedLargeVault

Function seedLargeVault

apps/desktop/src/main/vault.perf.test.ts:42–74  ·  view source on GitHub ↗
(root: string)

Source from the content-addressed store, hash-verified

40}
41
42async function seedLargeVault(root: string): Promise<void> {
43 await ensureVaultLayout(root)
44 await rm(path.join(root, 'inbox', 'Welcome.md'), { force: true })
45
46 const writes: Array<() => Promise<void>> = []
47 for (let index = 0; index < NOTE_COUNT; index += 1) {
48 const folder = `folder-${String(index % FOLDER_COUNT).padStart(2, '0')}`
49 const title = `Note ${String(index).padStart(5, '0')}`
50 const rel = path.join(root, 'inbox', folder, `${title}.md`)
51 const needle = `needle-${index}`
52 const body = [
53 `# ${title}`,
54 '',
55 `This synthetic benchmark note includes ${needle}.`,
56 'It has tags #perf #benchmark and enough body text to exercise metadata parsing.',
57 'The quick brown fox jumps over the lazy dog while ZenNotes indexes markdown.',
58 'A wikilink [[Synthetic Reference]] keeps wikilink extraction on the hot path.',
59 '',
60 '- [ ] task item for task extraction adjacent workloads',
61 '- [x] completed task item',
62 '',
63 'Final paragraph with repeated benchmark words for text search scoring.'
64 ].join('\n')
65 writes.push(async () => {
66 await mkdir(path.dirname(rel), { recursive: true })
67 await writeFile(rel, body, 'utf8')
68 })
69 }
70
71 for (let index = 0; index < writes.length; index += WRITE_BATCH_SIZE) {
72 await Promise.all(writes.slice(index, index + WRITE_BATCH_SIZE).map((write) => write()))
73 }
74}
75
76function sleep(ms: number): Promise<void> {
77 return new Promise((resolve) => setTimeout(resolve, ms))

Callers 1

vault.perf.test.tsFile · 0.85

Calls 1

ensureVaultLayoutFunction · 0.90

Tested by

no test coverage detected