git.lucas.co / cce-vault
notes vault library and CLI (Obsidian-compatible)
git clone https://git.lucas.co/cce-vault.git

bench/gen-vault.py (1.3K)

 1 #!/usr/bin/env python3
 2 """Generate a synthetic vault for timing cce-vault (see CLAUDE.md, Performance).
 3 
 4 usage: bench/gen-vault.py DIR [NOTES]    (default 5000 notes, ~40 MB)
 5 
 6 Each note has frontmatter tags and an alias, 20 random [[Note N]] links, an
 7 inline tag, twelve paragraphs of filler, three tasks and a fenced code block
 8 holding a link that must NOT be indexed. Seeded, so runs are comparable.
 9 """
10 import os, random, sys
11 
12 root = sys.argv[1]
13 n = int(sys.argv[2]) if len(sys.argv) > 2 else 5000
14 random.seed(1)
15 words = ("alpha beta gamma delta rust wayland vulkan note idea project meeting "
16          "design canvas graph index link task daily review plan").split()
17 for i in range(n):
18     folder = f"f{i % 40}"
19     os.makedirs(f"{root}/{folder}", exist_ok=True)
20     links = " ".join(f"[[Note {random.randrange(n)}]]" for _ in range(20))
21     body = "\n\n".join(" ".join(random.choice(words) for _ in range(60)) for _ in range(12))
22     tasks = "\n".join(f"- [{random.choice(' x')}] {random.choice(words)} {random.choice(words)}"
23                       for _ in range(3))
24     with open(f"{root}/{folder}/Note {i}.md", "w") as f:
25         f.write(f"---\ntags: [{random.choice(words)}]\naliases: [N{i}]\n---\n# Note {i}\n{links}\n"
26                 f"#{random.choice(words)}\n{body}\n{tasks}\n```\n[[NotALink]]\n```\n")