Skip to content

Conda: conda-meta/history is read multiple times per env per find() call #475

Description

@eleanorjboyd

Problem

In Conda::find, each spawned per-env worker reads the env's conda-meta/history file at least twice:

  1. In get_conda_installation_used_to_create_conda_env (crates/pet-conda/src/environments.rs) to recover the conda install dir from the # cmd: line.
  2. In CondaPackageInfo::from(env_path, Package::Python) (crates/pet-conda/src/package.rs) to recover the Python version from the +...:python-... line.

For installs with several envs and non-trivial history files, this is a meaningful amount of redundant sync I/O on every refresh — disproportionate on Windows where each file open is more expensive under default Defender real-time scan.

Proposal

In-flight memoization within a single find() call. Pass a shared map (e.g. Arc<DashMap<PathBuf, String>>) into the spawn loop so the second read of the same history file in the same refresh is free. No change to external behavior.

This is intentionally smaller and lower-risk than the broader caching question (clear-on-find / mtime-keyed cache), which I'll file separately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions