diff --git a/gen-perf-test.mjs b/gen-perf-test.mjs new file mode 100644 index 0000000..908f782 --- /dev/null +++ b/gen-perf-test.mjs @@ -0,0 +1,49 @@ +// Performance-Test: 100 Notizen generieren + Indexer laufen lassen +import { mkdirSync, writeFileSync, rmSync, existsSync } from 'node:fs'; +import { join } from 'node:path'; + +const TOPICS = ['Kaffee', 'Tee', 'Schlaf', 'Sport', 'Arbeit', 'Familie', 'Reisen', 'Musik', 'Buecher', 'Filme', 'Politik', 'Wissenschaft', 'Technik', 'Essen', 'Meditation', 'Sprachen', 'Geschichte', 'Kunst']; +const TAGS = ['arbeit', 'privat', 'projekt', 'idee', 'frage', 'notiz', 'reflexion']; + +const vaultPath = process.argv[2] ?? 'C:/Users/Jannik/AppData/Local/Temp/mindomat-perf-test'; +const count = parseInt(process.argv[3] ?? '100', 10); + +if (existsSync(vaultPath)) rmSync(vaultPath, { recursive: true, force: true }); + +const dirs = [ + '00_Inbox', '00_Inbox/Verarbeitet', '00_Inbox/Problemfaelle', + '01_Daily', '10_Wiki', '10_Wiki/Seiten', + '20_Projekte', '90_Templates', + '99_System', '99_System/Skripte', '99_System/Logs', '99_System/Cache', +]; +for (const d of dirs) mkdirSync(join(vaultPath, d), { recursive: true }); + +writeFileSync(join(vaultPath, '99_System/Konfig.md'), + '---\nveraltet_schwellwert_monate: 12\n---\n'); + +console.log(`Generiere ${count} Notizen...`); +for (let i = 1; i <= count; i++) { + const topic = TOPICS[Math.floor(Math.random() * TOPICS.length)]; + const tag = TAGS[Math.floor(Math.random() * TAGS.length)]; + const date = new Date(Date.now() - (i % 30) * 86400000).toISOString().slice(0, 10); + + const lines = [ + '---', + `title: ${topic} Notiz ${i}`, + `created: ${date}`, + `tags: [${tag}]`, + '---', + '', + `# ${topic} Notiz ${i}`, + '', + `Das ist der Inhalt der Notiz ${i} ueber ${topic}. Sie enthaelt mehrere Woerter, damit der Indexer etwas zu indexieren hat. Wikilinks auf [[${topic} Andere Notiz]] und [[Allgemeine Notiz]].`, + '', + `${(i % 5 + 1) * 5} Zeilen Text mit verschiedenen Woertern.`, + `Wichtige Erkenntnisse: Erkenntnis eins, Erkenntnis zwei, Erkenntnis drei.`, + 'Maschine Computer Software Hardware Konfiguration Installation Update Backup Recovery Performance.', + `Absatz mit mehr Text zu ${topic}: Details, weitere Details, noch mehr Details.`, + ]; + const filename = `${date}_${topic}_Notiz_${i}.md`; + writeFileSync(join(vaultPath, '01_Daily', filename), lines.join('\n')); +} +console.log(`${count} Notizen geschrieben.`);