Skip to content

Dependency calculation performance poor even with cache warm cache #18911

Open
@jriddy

Description

@jriddy

Describe the bug
When running ./pants dependees $something (or ./pants dependencies :: which is broadly equivalent in terms of the work Pants needs to do), I get poor performance on my repo. This would be more bearable, except that it seems to persist even with a warm cache. Just killing pantsd or running with --no-pantsd is enough to make it take ~40s to get a full dep calculation, even if all inferences should be cached recently.

My repo has ~4500 python files, with another ~3000 non-inferrable targets. It's big and has a complex import graph, but not crazy.

What's weirder is that this problem gets demonstrably worse with --no-python-infer-imports on. So it seems to be more a problem with how Pants is dealing with my repo than with an issue with dependency inference per se.

This is probably "fine" for CI but we have more and more devs interacting with Pants (which is a good thing!) but they're hitting this wall and wondering what's up, with good reason. I can write a pretty naive import scanner in Python that outperforms Pants with a cache, so something must be off.

Slack link: https://pantsbuild.slack.com/archives/C046T6T9U/p1683234968526959

Pants version
2.15.0

OS
Linux. Unsure if it's affecting MacOS users.

Additional info
I've attached some py-spy recordings of this. These were run with --no-pantsd.

With inference on:
pants-dependencies-inference
pants-dependencies-inference.speedscope.zip

With no-python-infer-imports:
pants-dependencies
pants-dependencies.speedscope.zip

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions