Skip to content

Conversation

@haampie
Copy link
Member

@haampie haampie commented Jan 4, 2026

Running Spec() triggers the parser to run on a single byte ":", which then
triggers slow construction of a version range object.

Given that the parser itself runs Spec() a lot when parsing dependencies, there's
a curious unintended recursion worth fixing.

Using timeit the constructor goes from 3.25us -> 1.90us. Package load time
improves from 27.3s -> 24.1s, or about 11% reduction.

time python3 -c 'import spack.repo; x = list(spack.repo.PATH.all_package_classes())'

@haampie haampie force-pushed the hs/fix/speedup-spec-constructor branch from be1e157 to abf1bf3 Compare January 4, 2026 10:42
Signed-off-by: Harmen Stoppels <me@harmenstoppels.nl>
@haampie haampie force-pushed the hs/fix/speedup-spec-constructor branch from abf1bf3 to 824fc7e Compare January 4, 2026 11:15
@haampie haampie added versions and removed versions labels Jan 5, 2026
@alalazo alalazo self-assigned this Jan 5, 2026
@alalazo alalazo merged commit 2021c36 into develop Jan 5, 2026
34 checks passed
@alalazo alalazo deleted the hs/fix/speedup-spec-constructor branch January 5, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants