Skip to main content

Module warm_parse

Module warm_parse 

Source
Expand description

Parsed modules that a long-lived process keeps across analysis sessions.

A typed MCP tool call builds a new AnalysisSession for each call. Each session loads the persisted parse cache, checks each file against it, and writes the cache back. A process that installs a WarmParseStore keeps the parsed modules of recent sessions in memory. A later session with the same file list and the same file fingerprints takes its modules from the store and does no parse work.

The store is safe to share between sessions with different configs, because a parse depends only on the file path, the file content, and the config hash of the persisted parse cache. The key holds all three: the project root and the cache config hash, the ordered file list (the file ids follow from it), and one fingerprint per file. The store keeps a module only when each fingerprint can stand in for the file content without a content check, which needs a known ctime. On a platform with no ctime, such as Windows, each session parses through the persisted cache as before.

The limit of the store is on the memory of the kept modules. The store cannot measure that memory, so it makes an estimate from the source size and the file count. Each kept file list holds its own modules: two lists that share files, such as a full list and a production list, each count in full.

Structs§

WarmParseCounts
The parse work of the sessions that used a store.
WarmParseLimits
Memory limits of a WarmParseStore.
WarmParseStore
Parsed modules kept across analysis sessions in one process.

Constants§

DEFAULT_MAX_ENTRIES
The default number of parsed file lists that a store keeps.
DEFAULT_MAX_RETAINED_BYTES
The default limit on the estimated memory of the kept modules.

Functions§

estimated_retained_bytes
The estimated heap memory of the parsed modules of the files with these fingerprints: 12 bytes for each source byte, plus the size of one module struct for each file. WarmParseLimits::max_retained_bytes applies to this estimate.
install
Make store the store of each session that this process creates from now on. None removes the store, so new sessions parse as before.
installed
The store that new sessions use, if a process installed one.