Skip to content

Improvements for pcpelms.gi - #284

Open
stertooy wants to merge 1 commit into
gap-packages:masterfrom
stertooy:improv-pcpelms
Open

stertooy wants to merge 1 commit into
gap-packages:masterfrom
stertooy:improv-pcpelms

Conversation

@stertooy

Copy link
Copy Markdown
Collaborator

This does a few things:

  • Provides shortcuts "powers of generators". In particular, taking very large powers of a single collector generator is now much faster.
  • Avoids some duplicate triviality checks and useless allocations (mostly the introduction of FactorOrderNT).
  • Replaces some genering Gcd and IsPrime's by their integer-specific function.
  • Provides a faster IsOne method for pcp-elements.

A quick check, based only on the test suite:

  • Time needed to go through the tests decreased by ~4.5%
  • Allocated memory decreased by ~6.5%

To illustrate the gains for "powers of generators", consider the following three operations:

gap> U := UnitriangularPcpGroup( 10, 0 );;
gap> U.2 ^ 100000;
gap> Comm( U.2 ^ 40000, U.2 ^ -30000 );
gap> ( U.2 ^ 40000 ) ^ ( U.2 ^ -30000 );

On master, these take 3.3 ms, 1.4 ms and 2.0 ms on average, respectively. With this PR, that becomes 1.4 µs, 0.8 µs and 0.4 µs.

I'll note that there is still room for improvement:

  1. LeadingExponent, Depth and TailOfElm still perform a lot of unnecessary triviality checks.
  2. Many of the functions here are "wrappers" for accessing components. "Unpacking" those would probably improve performance further, but at the cost of readability.

I'm happy to implement these further improvements as well, but I wanted to get some feedback on this first.

@codecov

codecov Bot commented Oct 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.82353% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.62%. Comparing base (7e84dbe) to head (cb1299b).

Files with missing lines Patch % Lines
gap/basic/pcpelms.gi 83.82% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #284      +/-   ##
==========================================
+ Coverage   71.51%   71.62%   +0.10%     
==========================================
  Files          88       88              
  Lines       13029    13063      +34     
==========================================
+ Hits         9318     9356      +38     
+ Misses       3711     3707       -4     
Files with missing lines Coverage Δ
gap/basic/pcpelms.gi 87.72% <83.82%> (+1.16%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

1 participant