Skip to content

Performance and Caching

Hugo edited this page Sep 25, 2026 · 1 revision

Performance and Caching

Measured cost

One core of a laptop, single process, cold start, with the bundled plugins (September 2026):

Project Python lines Functions Time Peak memory
healthchecks (Django application) 45 000 2 566 7 s 107 MB
rich (library) 52 000 1 198 6 s 106 MB
wagtail (Django CMS) 273 000 12 146 85 s 461 MB

Time grows a little faster than linearly with project size, because the interprocedural summaries are iterated to a fixpoint over the module graph.

healthchecks is part of the regression corpus, so the analysis time of a real 45 000-line project is exercised on every change rather than measured once and quoted forever.

Cache

coretrace-python-analyzer --check src/ --cache .coretrace

--cache DIR keeps the results of a directory check on disk, one entry per module, keyed by:

  • the module's source;
  • the tool version;
  • every file of every plugin directory — code, manifest and data alike;
  • the security models, including those a plugin read from the project;
  • the advisories;
  • the dependency graph;
  • the modules it imports.

On the next run an unchanged module is served from the cache, so editing one file re-analyses that file and its importers only.

Entries are plain data, and an unreadable entry is simply recomputed — a corrupt cache costs time, never correctness.

A warm cache brings an unchanged healthchecks to about one second.

What invalidates it

Bumping a plugin's version, editing any file in a plugin directory, changing an advisory file or the dependency graph all change the key. This is deliberate: a cached result must not survive a change in what produced it. The same digest identifies the plugin in the reports, so a cached run and its report agree on their inputs.

Parallelism

coretrace-python-analyzer --check src/ --jobs 4

--jobs N analyses independent modules in N processes. Modules are scheduled imports first, so the result is the same whatever N — parallelism changes the speed, never the findings.

--jobs 4 saves about a quarter of the cold time, at the cost of one process's memory per job.

Putting both together

coretrace-python-analyzer --check src/ --cache .coretrace --jobs 4

In CI, restore the cache directory between runs to analyse only what changed. See Reports and CI.

Clone this wiki locally