Skip to content

reuse.py: avoid _create_external_parser - #51653

Merged
alalazo merged 1 commit into
developfrom
hs/fix/avoid-create_external_parser
Dec 10, 2025
Merged

alalazo merged 1 commit into
developfrom
hs/fix/avoid-create_external_parser

Conversation

@haampie

@haampie haampie commented Nov 27, 2025 •

Copy link
Copy Markdown
Member

The function _create_external_parser is called for each reuse source, and triggers some expensive code paths down the line. Fix by calling it once ahead of time.

Also some renaming:

  • packages -> packages_with_externals
  • _create_external_parser -> create_external_parser

@haampie
haampie force-pushed the hs/fix/avoid-create_external_parser branch from 626ba63 to 7060448 Compare November 27, 2025 15:54
Comment thread lib/spack/spack/solver/asp.py
Comment thread lib/spack/spack/solver/reuse.py Outdated
@haampie
haampie force-pushed the hs/fix/avoid-create_external_parser branch 5 times, most recently from 0711138 to 0b24292 Compare December 8, 2025 09:43
@haampie haampie mentioned this pull request Dec 9, 2025
2 tasks done
In the setup phase of the solver, pre-process the packages.yaml config
once (i.e. expanding config on virtuals to config on its providers, and
adding libc from compiler inspection) and compute the effective external
specs once and only once. This should speed up the setup phase.

Signed-off-by: Harmen Stoppels <[email protected]>
@haampie
haampie force-pushed the hs/fix/avoid-create_external_parser branch from 0b24292 to 27c5840 Compare December 9, 2025 10:53

@alalazo alalazo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can polish the function calls later. This still gives a 5% improvement on setup time on my laptop.

@alalazo
alalazo merged commit 044f290 into develop Dec 10, 2025
58 of 59 checks passed
@alalazo
alalazo deleted the hs/fix/avoid-create_external_parser branch December 10, 2025 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants