镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Investigate ways to speed up venv creation #317

Open

Description

@mdboom

According to the log timestamps, benchmark runs currently spend 3 minutes creating virtual environments.

We might be able to reduce that by caching the results of the sat solver and reusing that (that should only change when pyperformance/python_macrobenchmarks are updated).

An earlier experiment with uv was about 2x faster (from memory), but that adds another dependency.

Cc: @mpage, @colesbury

Activity

  1. mpage commented on Dec 11, 2024

    @mpage
    Collaborator

    benchmark runs currently spend 3 minutes creating virtual environments.

    Is that 3 minutes per benchmark run or 3 minutes in aggregate?

  2. mdboom commented on Dec 11, 2024

    @mdboom
    ContributorAuthor

    Is that 3 minutes per benchmark run or 3 minutes in aggregate?

    In aggregate.

  3. mdboom commented on Dec 16, 2024

    @mdboom
    ContributorAuthor

    For anyone seeing significantly longer venv creation times than ~3 minutes, @Fidget-Spinner had success by upgrading pip to a more recent version: python/pyperformance#375 (comment)

  4. Fidget-Spinner commented on Jan 8, 2025

    @Fidget-Spinner
    Contributor

    I upgraded pip but it reduced the time by half. So it's still somewhere like 15-30 minutes. I know someone else who just set up pyperformance and it's doing the same too. So maybe this is really worth it to implement for machines that are somehow slower.

  5. mdboom commented on Jan 8, 2025

    @mdboom
    ContributorAuthor

    Isn't it the case that if you are running locally, the venvs are reused between runs, so this cost is only paid once?

    For github actions (clean VMs), of course we pay it every time, but there the 3 min cost seems negligible.

    Or am I missing something?

  6. Fidget-Spinner commented on Jan 8, 2025

    @Fidget-Spinner
    Contributor

    but there the 3 min cost seems negligible

    Yeah that's the strange part. For my machine and the other person I mentioned, it takes longer than that. Something like 30 minutes to set up venvs in total. I upgraded pip to the latest version.

  7. mdboom commented on Jan 8, 2025

    @mdboom
    ContributorAuthor

    If this was run in Github Actions, the log should have a timestamp for each line, so maybe that would offer some clues as to where the time is going.

  8. Fidget-Spinner commented on Jan 8, 2025

    @Fidget-Spinner
    Contributor

    This was manual pyperformance sadly, so I don't have timestamps anymore, sorry! However, on my end I ran the benchmarks manually on my machine and watched them and the venv creation was definitely way over 3 minutes.

  9. mdboom commented on Jan 8, 2025

    @mdboom
    ContributorAuthor

    Interesting. My main objection was to the approach was creating the venvs in parallel, since I don't think that's guaranteed to create the same results each time which is bad for reproducibility.

    It might be fruitful to experiment with using uv (but still creating the venvs in order) rather than pip to see if that helps. (An alias from pip install to uv pip install may be enough). Even if we don't end up using that on Github Actions (where installing uv negates the benefit a bit), having that as an option might help people running pyperformance locally who are hitting this issue).

    Though I suspect there's just some environmental difference (maybe file system setup) that makes it slower in some cases -- but that's just a hunch.

  10. Fidget-Spinner commented on Mar 14, 2025

    @Fidget-Spinner
    Contributor

    Ok I think I've narrowed down a key difference on why my venvs take so much longer: I'm using miniconda and its associated venvs for venv management on my system. That's the only difference I can see. Will try normal pip3 venv and see if there's any difference.

    Edit: it made no difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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