Skip to content

Call binding recomputes candidate file facts on every call, so a cold Kubernetes build takes 21 minutes #5666

Backlog

Description

@Max17190

On v8 at d249de36 (0.9.124), a cold build of Kubernetes takes 21 minutes. Most of it goes to cross-file call binding, which recomputes facts about a candidate's source file once per candidate per call.

  1. _go_import_path_for_file runs for each candidate of each Go selector call at graphify/extract.py:14516. Its cache only stores directories that contain a go.mod, so every call walks the ancestors again.
  2. _lang_family runs for each candidate of each call.
  3. disambiguate_ambiguous_candidates rebuilds set(test_cands) for each element at graphify/paths.py:512. That is quadratic, and it affects every language.

A py-spy profile attributes about 600s to the first, 33s to the second and 186s to the third.

To reproduce, clone kubernetes at ce9710e510 and run time graphify update .. Three runs took 1322s, 1262s and 1255s on Linux with CPython 3.12.3.

Expected: each file's facts are computed once per pass, and the output does not change.

Activity

  1. github-actions commented on Dec 1, 2026

    @github-actions

    Thanks for opening this issue, @Max17190. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

  2. changed the title [-]Cross-file call binding re-derives candidate file facts on every call, so a cold Kubernetes build takes 21 minutes[/-] [+]Call binding recomputes candidate file facts on every call, so a cold Kubernetes build takes 21 minutes[/+] on Dec 1, 2026
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