Skip to content

Latest commit

 

History

History
181 lines (147 loc) · 14.2 KB

advanced.md

File metadata and controls

181 lines (147 loc) · 14.2 KB

Advanced settings and diagnostics

Most users never need to change anything on this page. The settings below tune how the extension uses the Lore library on large repositories, and the diagnostics help find out where memory goes. They are mainly for investigating a problem.

Settings

Setting Default Purpose
lore-vs-code.enabled true Enable the extension. Disabling it stops the source control provider from registering at all.
lore-vs-code.statusPollInterval 3000 Milliseconds between cheap revision-only polls that detect out-of-band changes. Minimum 1000.
lore-vs-code.maxFileConcurrency 128 Maximum concurrent file operations in the Lore native library. 0 uses the library default of 10000.
lore-vs-code.maxThreads 0 Exact number of native library threads, used as-is even above the CPU count. 0 means automatic: the machine's CPU count, capped by maxThreadsAutoCap.
lore-vs-code.maxThreadsAutoCap 12 Upper bound on the automatic thread count. 0 uses the built-in default of 12. Ignored when maxThreads is set.
lore-vs-code.statusDebounceInterval 1000 Milliseconds of quiet after a file change before the source control view is refreshed. Higher values run fewer refreshes while editing.
lore-vs-code.fileDirtyThrottleInterval 250 Milliseconds over which file change events are collected before being reported to Lore in a single call. Higher values make bulk changes cheaper to track.
lore-vs-code.branchDiffCacheMaxAge 300000 Milliseconds a personal-branch diff may be reused before it is recomputed. No effect on other branches.
lore-vs-code.nativeArgs {} Advanced. Extra arguments passed to every native library call, e.g. {"fileSizeLimit": 67108864}. Overrides the settings above for the same argument.
lore-vs-code.diagnostics.memory false Record extension-host memory and per-operation resource usage. See Diagnosing resource usage.
lore-vs-code.diagnostics.memorySampleInterval 60000 Milliseconds between periodic memory samples while diagnostics are on. Minimum 5000.
lore-vs-code.developerOptions {} Advanced options object, for development use.

nativeArgs is the escape hatch: any argument the bundled library already understands becomes reachable without a new build of the extension — fileSizeLimit, storeKeepAlive, storeKeepAliveSeconds, compressTaskLimit, maxConnections, noGc, cache, searchLimit. Names must match the library's camelCase spelling exactly. A snake_case or misspelled name is accepted and silently ignored, which looks identical to a value that had no effect. Note that maxThreads is not a call argument — it is applied through a separate entry point — so it cannot be set this way.

Where to change them

Settings UI: Extensions -> Lore, or search for lore-vs-code in the settings search box. The two diagnostics.* keys appear grouped under a Diagnostics subsection.

Or edit settings.json directly (Command Palette -> Preferences: Open User Settings (JSON)):

{
  "lore-vs-code.diagnostics.memory": true,
  "lore-vs-code.maxFileConcurrency": 128,
  "lore-vs-code.maxThreads": 0,
  "lore-vs-code.maxThreadsAutoCap": 12
}

All of these are user-level only. Every setting is declared with VS Code's machine scope, so it appears on the User tab and not on the Workspace or Folder tabs. That is deliberate: they configure a single native library instance shared by the whole extension host, so a per-workspace value would be meaningless when two folders are open at once. The practical consequence is that a repository cannot pre-configure them through a checked-in .vscode/settings.json — each person sets them on their own machine, or you send them a settings.json snippet to paste.

In a Remote SSH, WSL, or dev container window, machine-scoped settings live in that window's Remote settings rather than in local user settings.

Settings that need a window reload

maxThreads, maxThreadsAutoCap, maxFileConcurrency and nativeArgs are read once during activation, because the native library fixes the values on the first call made to it and ignores later attempts to change them. Changing any of them prompts for a reload; without reloading, the new value has no effect at all.

statusDebounceInterval and branchDiffCacheMaxAge are read per use and apply immediately.

Every resolved value is written to the Lore output channel on activation, as a single Lore tuning: ... line that includes the machine's CPU count — the automatic thread count is derived from it, so the resolved number alone does not identify which setting produced it. The line is logged at info level, so it is visible without changing the channel's log level. The same values are stamped into every diagnostics summary, so a collected dump says what was in force when it was recorded.

Every other setting takes effect immediately.

Diagnosing resource usage

lore-vs-code.diagnostics.memory turns on measurement of what the extension host actually costs. It exists to answer attribution questions — whether memory growth in a VS Code window originates in this extension or somewhere else in the process — so the output is per-operation rather than a single total.

While enabled, the extension records:

  • for each native library operation: call count, errors, total and maximum duration, summed and maximum resident-memory delta, and the number of events returned
  • periodic samples of heap, external, array-buffer and resident memory
  • on Windows, the process commit charge, which is the figure that is exhausted in reported out-of-memory crashes and which resident memory does not reflect

Reading the data:

  • Run Lore: Dump Resource Diagnostics from the Command Palette at any point to write a summary to the Lore output channel and bring it into view. A summary is also written automatically when the extension shuts down.
  • Set the LORE_LOG_DIRECTORY environment variable (or the legacy URC_LOG_DIRECTORY) before launching VS Code to also mirror every sample to lore-vs-code-resources.log in that directory, alongside the native library's own log. This is an environment variable rather than a setting because it has to be known before the extension starts, and it is the only way the samples end up in a collected log bundle. Without it the data exists only in the output channel and will not be present in a submitted report.

Diagnostics are off by default and cost nothing while off — the measurement wrapper becomes a pass-through. Turning them on adds two process.memoryUsage() reads, two timestamp reads, and a counter update around each library call, so it is not free and is not intended to be left on permanently. File writes are asynchronous and never block the extension host, and the mirror file is rotated by discarding its middle so that both the start and the end of a long session are preserved.

Operations are reported under the SDK call they wrap, for example branchDiff, revisionHistory and fileWrite. Note that repository status appears as three entries: repositoryStatus:scan for the full working-tree scan that runs once, in the background, shortly after the workspace is opened; repositoryStatus for every other refresh, which reads back only the files already flagged as changed; and repositoryStatus:poll for the frequent revision-only poll driven by statusPollInterval. File changes reach Lore through fileDirty, one call per fileDirtyThrottleInterval window. The poll is by far the most numerous call in a session, so compare like with like when reading the summary.

Comparing a configuration change

Why these settings exist. None of the resource defaults were derived from measurement — they are bounded guesses, carried over from the change that first introduced them. They are exposed so that the values can be established from data on a real workload, on real hardware, without a new build of the extension for every value tried. If a value turns out to matter, its default should change; if it turns out not to, that is worth knowing too, and the number can stop being debated.

The variables, and what sweeping each one answers:

Variable Sweep Question it answers
maxFileConcurrency 0 (library default 10000), 64, 128, 256 Does bounding concurrent file operations reduce peak memory during a scan?
maxThreadsAutoCap 12 (default), 16, 24, 64 Does the thread bound affect memory at all, and at what value does loosening it start to cost something?
maxThreads 8, 16, a value above the CPU count Does an exact thread count differ from the automatic one, and does exceeding the core count cost anything?
statusDebounceInterval 1000 (default), 3000, 10000 How much of the cost is refresh frequency rather than repository size?
fileDirtyThrottleInterval 250 (default), 1000, 5000 During bulk changes, how much does batching the dirty-marking calls save?
branchDiffCacheMaxAge 300000 (default), 60000, 0 On a personal branch, how much does reusing the parent-branch diff save?
nativeArgs e.g. {"fileSizeLimit": 67108864}, {"storeKeepAlive": true} Anything the library supports that has no dedicated setting.

Sweep one variable at a time, holding the others at their defaults.

Establish the unset thread count before sweeping thread values. The native library spawns its own number of threads when no limit is set, and a limit above that number changes nothing — so a sweep that starts too high measures the same configuration every time. That baseline depends on both the machine's core count and the library version, and it has moved between versions, so read it off the running process rather than assuming a value: with diagnostics enabled, compare a run with no limit set against the values you are testing. Sweep below the baseline, and treat measurements taken either side of an SDK bump as belonging to different sets.

  1. Enable lore-vs-code.diagnostics.memory and reload the window.
  2. Confirm the run's inputs. The [resource] config ... line at the top of every summary reports every resolved value, so a dump is self-describing and no separate note is needed. The same values appear as the Lore tuning: ... line in the output channel at activation. Check them against what you intended — a reload-required setting changed without a reload shows here as the previous value.
  3. Reproduce the workload — for a save-driven problem, repeatedly edit and save a file in a large repository for several minutes. For a startup problem, reload the window. Note the repository's file and directory count (lore status --count) and whether the branch is main or a personal branch: the personal-branch path runs an extra comparison that main never does.
  4. Run Lore: Dump Resource Diagnostics and keep the summary alongside the line from step 2.
  5. Change one setting, reload, and repeat the identical workload.
  6. Compare sumRssDelta and maxRssDelta for the repositoryStatus:scan entry (the startup scan) or the repositoryStatus and fileDirty entries (the save path) — not repositoryStatus:poll — and the commit= values in the periodic samples, between the two runs.

Interpreting the result:

  • If the difference is within run-to-run noise, that is a real result worth recording: the value is not the lever for that workload. Two runs at the same setting establish what the noise is; do that first, or a single pair of runs cannot be read at all.
  • Growth that appears in the first minute and then holds flat is warm-up, not accumulation. Compare the plateau, not the peak.
  • Thread values below 6 are not expected to take effect: the limit is apportioned across three native pools with a minimum of 2 each, so anything lower resolves to the same six threads.
  • The concurrency settings need a window reload, and a run measured without reloading measures the previous value. Step 2 is what catches that.

Behaviour notes

  • On a personal branch, the source control view shows changes committed on the branch relative to its parent, in addition to uncommitted local changes. That comparison uses the parent branch's last-synced local revision, not its current remote revision, so a parent branch that has moved on the server is not reflected until the next sync. New remote revisions are still visible in the revision history view.