Performance vaults
Use the shared performance corpus when comparing indexing or search implementations. generatePerformanceVault() returns a map accepted by TemporaryVault.populate(): exactly 37,000 markdown notes containing exactly 110,000,000 UTF-8 content bytes by default. The byte total includes scenario notes and excludes paths, configuration, plugins and filesystem metadata. MB means decimal megabytes here.
import { generatePerformanceVault } from '@mnaoumov/obsidian-dev-toolkit/test-runners/performance-vault';
const files = generatePerformanceVault({ cyrillicShare: 0.25, noteCount: 37_000, totalBytes: 110_000_000});The result is deterministic, including insertion order and directory layout. It reads no environment variables and writes no files. cyrillicShare selects the fraction of filler notes containing Cyrillic prose, rounded down; it is neither a byte ratio nor a fraction of all characters. By default (prose: 'repeated') filler notes repeat one ordinary sentence per language, with spaces absorbing the final byte remainder without splitting a Unicode character. That suits metadata-cache scans, but its few dozen distinct words do not model the term distribution of a personal vault, so a full-text or trigram index over it can measure neither index size nor query selectivity. Use prose: 'varied' for those.
Varied prose
Section titled “Varied prose”import { generatePerformanceVault, PERFORMANCE_VAULT_PLANTED_TERMS} from '@mnaoumov/obsidian-dev-toolkit/test-runners/performance-vault';
const files = generatePerformanceVault({ prose: 'varied', proseSeed: 1 });With prose: 'varied', each filler note is a run of sentences of 6 to 17 words drawn from a synthetic vocabulary of PERFORMANCE_VAULT_VOCABULARY_SIZE (20,000) words per language, English for Latin notes and Ukrainian-looking words for Cyrillic ones. Word ranks follow Zipf’s law (the word of rank r is drawn with weight 1 / r), and frequent words are shorter, as in natural language: one syllable for the 9 most frequent, up to four for the long tail. At the default size the corpus holds all 40,000 vocabulary words. Note count, byte total, paths, fixtures and cyrillicShare behave exactly as with repeated prose, and spaces still absorb each note’s byte remainder.
A syllable vocabulary alone has few distinct trigrams: every word is consonant-vowel pairs, so the default corpus would hold only 6,959 distinct case-folded character trigrams, each with a long posting list in every note, and a trigram index measured on it would look slower and larger than on a real vault, whose names, links, dates and code add a long tail of rare trigrams. So rareTokenShare (default 0.02) of the words after the first of each sentence are rare tokens instead: half id-like tokens (hex hashes, YYYY-MM-DD dates and -/_ slugs over lowercase letters and digits, ASCII in both languages) and half words of 3 to 10 letters drawn by letter frequency rather than by syllable. With the defaults the corpus holds 84,211 distinct trigrams (counted over each note’s case-folded text, spaces and punctuation included); 0.01 gives 76,435 and 0.05 gives 92,127. rareTokenShare: 0 reproduces the 'varied' corpus 7.2.0 generated, byte for byte.
Everything is derived from proseSeed (a nonnegative safe integer, default 1): the same seed yields the same corpus on every platform, and another seed yields another vocabulary and other notes. The seed does not affect repeated prose, and the default corpus is byte-for-byte the one 7.1.0 generated.
PERFORMANCE_VAULT_PLANTED_TERMS lists four rare terms with known document frequencies: filler note i (in path order) contains, once, each term whose interval divides i, so a term occurs in exactly Math.ceil(fillerCount / interval) notes. The intervals are 10, 100, 1,000 and 10,000 (zq10x, zq100x, zq1000x, zq10000x); at the default size, with 33,948 filler notes, that is 3,395, 340, 34 and 4 notes. No vocabulary word or rare token contains q, so nothing else matches them. The planted terms follow the first word of a note. Scenario notes keep their fixed prose in both modes.
Scenarios
Section titled “Scenarios”The default scenarios preserve the Advanced Metadata Cache performance suites’ paths:
target.mdand 50links/link-<n>.mdnotes linking to it (linkerCount).- 1,000
mentions/note-<n>.mdprose notes (mentionCount), every 25th containing an unlinked mention of the target (mentionInterval, starting at zero). delete-target.mdand two identical folders,to-delete-aandto-delete-b, each containing 1,000 linking notes (deletionCount). Deleting one with a plugin enabled and the other disabled compares the same cascade.- All remaining notes under
big/dir-<n>/file-<n>.md, 30 per folder (filesPerFolder).
The two target notes always exist. Scenario counts may be zero, but the exact noteCount must leave at least one filler note. The byte budget must fit every scenario and at least one sentence in every filler note. Invalid counts, fractions or budgets throw RangeError. Exported PERFORMANCE_VAULT_* path constants keep consumers aligned with the fixtures. A consumer migrating from AMC’s former helper must include its scenario notes in noteCount; that helper counted filler notes only.
Populate before opening Obsidian
Section titled “Populate before opening Obsidian”In the performance project’s global setup module, export the hooks returned by the factory:
import { createPerformanceVaultSetup } from '@mnaoumov/obsidian-dev-toolkit/test-runners/performance-vault-setup';
export const { setup, teardown } = await createPerformanceVaultSetup({ cyrillicShare: 0.25, noteCount: 37_000, totalBytes: 110_000_000});Set that module as the performance project’s globalSetup, retaining the harness’s setupFiles and serial file execution. The factory delegates to obsidian-integration-testing/vitest-global-setup-plugin and supplies a populate callback that runs before Obsidian opens. All three modules can load without the optional harness installed; setup and readiness import it only when called. Install obsidian-integration-testing to use those functions.
Wait before measuring
Section titled “Wait before measuring”The measurement suite waits for startup indexing in Node:
import { waitForPerformanceVaultScan } from '@mnaoumov/obsidian-dev-toolkit/test-runners/performance-vault-scan';import { getTemporaryVault } from 'obsidian-integration-testing/vitest-global-setup-plugin';import { beforeAll } from 'vitest';
beforeAll(async () => { await waitForPerformanceVaultScan({ cachePath: 'links/link-0.md', expectedFileCount: 37_000, vaultPath: getTemporaryVault().path });}, 300_000);Readiness requires the exact expected file count, metadata for cachePath, and zero metadata parse tasks for three consecutive polls. Every failing sample resets that streak, even if the file count stays unchanged. Set cachePath to an existing note with metadata when disabling the link fixtures. Include any additional files your setup creates in expectedFileCount; an incomplete but stable scan and an oversized vault both fail readiness.
The default interval is 2,000 ms and the overall timeout is 240,000 ms, configurable through intervalInMilliseconds, timeoutInMilliseconds and stablePollsRequired. Each transport evaluation only reads the status; the long wait runs in Node through pollInObsidian, outside the per-evaluation cap. Give the enclosing Vitest hook enough time for the overall budget. Run performance files serially and cap workers at the machine’s assigned budget, including BULK_CORES during bulk work.