Problem
Conda::find calls self.clear() at the top of every invocation, wiping environments, managers, and mamba_managers. Every full refresh then rebuilds everything from scratch — including re-reading each env's conda-meta/history, re-running per-env package detection, and re-resolving the conda install for each env.
The Arc<LocatorCache<PathBuf, PythonEnvironment>> on the struct suggests the cache is meant to live across calls, but in practice it never does because of the clear-on-find. For installs with many envs this is the dominant cost on every refresh.
Proposal
Apply the mtime-keyed cache pattern from #469 (Hatch TOML parse cache). Cache CondaEnvironment entries keyed on the prefix plus the relevant conda-meta/* mtimes (history file, and/or conda-meta directory mtime). On find(), stat the keying paths first; if mtimes are unchanged, reuse the cached entry. Cold path is unchanged; warm path becomes stat-only.
This is independent of and bigger than #475 (in-flight memoization within a single find() — filed separately). The two are complementary: the memoization fix dedupes reads inside one call; this one skips work across calls.
Related: #469 (same pattern for Hatch).
Problem
Conda::findcallsself.clear()at the top of every invocation, wipingenvironments,managers, andmamba_managers. Every full refresh then rebuilds everything from scratch — including re-reading each env'sconda-meta/history, re-running per-env package detection, and re-resolving the conda install for each env.The
Arc<LocatorCache<PathBuf, PythonEnvironment>>on the struct suggests the cache is meant to live across calls, but in practice it never does because of the clear-on-find. For installs with many envs this is the dominant cost on every refresh.Proposal
Apply the mtime-keyed cache pattern from #469 (Hatch TOML parse cache). Cache
CondaEnvironmententries keyed on the prefix plus the relevantconda-meta/*mtimes (history file, and/orconda-metadirectory mtime). Onfind(), stat the keying paths first; if mtimes are unchanged, reuse the cached entry. Cold path is unchanged; warm path becomes stat-only.This is independent of and bigger than #475 (in-flight memoization within a single
find()— filed separately). The two are complementary: the memoization fix dedupes reads inside one call; this one skips work across calls.Related: #469 (same pattern for Hatch).