Skip to content

Replace many redundant uses of IsContainedInSpan#6287

Merged
fingolfin merged 1 commit intomasterfrom
mh/CloseMutableBasis
Mar 27, 2026
Merged

Replace many redundant uses of IsContainedInSpan#6287
fingolfin merged 1 commit intomasterfrom
mh/CloseMutableBasis

Conversation

@fingolfin
Copy link
Copy Markdown
Member

@fingolfin fingolfin commented Mar 27, 2026

Instead use the return value by CloseMutableBasis (which was not always there but was added by @ThomasBreuer in 2019 in PR #3247), which explains why so much code did not make use of it).

This essentially avoids doing the same computation twice, and can have a quite noticeable performance benefit in some cases.

Instead use the return value by CloseMutableBasis (which was
not always there but added in 2019, which explains why so much
code did not make use of it).

This essentially avoids doing the same computation twice, and can
have a quite noticeable performance benefit in some cases.
@fingolfin fingolfin requested a review from ThomasBreuer March 27, 2026 15:34
@fingolfin fingolfin added kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements topic: performance bugs or enhancements related to performance (improvements or regressions) topic: library release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes labels Mar 27, 2026
Copy link
Copy Markdown
Contributor

@ThomasBreuer ThomasBreuer left a comment

Choose a reason for hiding this comment

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

Nice.

(I do not remember the circumstances of #3247,
in particular why the code was not improved already at that time.)

@fingolfin
Copy link
Copy Markdown
Member Author

Note that also a bunch of packages could potentially benefit from similar changes, basically all that use IsContainedInSpan:

$ rg --type=gap -l IsContainedInSpan pkg/   | sort | cut -d/ -f2 | uniq
corelg
ctbllib
fining
liealgdb
polycyclic
qpa
recog
repsn
sla

@fingolfin fingolfin enabled auto-merge (squash) March 27, 2026 17:03
@fingolfin fingolfin merged commit 56099db into master Mar 27, 2026
32 checks passed
@fingolfin fingolfin deleted the mh/CloseMutableBasis branch March 27, 2026 17:05
cdwensley pushed a commit to cdwensley/gap that referenced this pull request Apr 1, 2026
Instead use the return value by CloseMutableBasis (which was
not always there but added in 2019, which explains why so much
code did not make use of it).

This essentially avoids doing the same computation twice, and can
have a quite noticeable performance benefit in some cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes topic: library topic: performance bugs or enhancements related to performance (improvements or regressions)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants