Skip to content

Speed up ConvertToVectorRep and CopyToVectorRep - #6817

Open
fingolfin wants to merge 2 commits into
masterfrom
mh-ai/faster-vector-rep-conversion
Open

fingolfin wants to merge 2 commits into
masterfrom
mh-ai/faster-vector-rep-conversion

Conversation

@fingolfin

Copy link
Copy Markdown
Member

ConvertToVectorRep(v, q) for a GF(2) vector v, and CopyToVectorRep(v, q) for a GF(2) or GF(q0) vector v, with GF(q) a larger field, took the generic path, which inspects every entry in GAP code. The kernel rewrites such vectors directly.

Setup:

gap> L:= List(IdentityMat(600, GF(2)), ShallowCopy);;

Before:

gap> M:= List(L, v -> CopyToVectorRep(v, 4));; time;
100
gap> M:= List(M, v -> CopyToVectorRep(v, 16));; time;
92
gap> for v in L do ConvertToVectorRep(v, 4); od; time;
99

After:

gap> M:= List(L, v -> CopyToVectorRep(v, 4));; time;
2
gap> M:= List(M, v -> CopyToVectorRep(v, 16));; time;
1
gap> for v in L do ConvertToVectorRep(v, 4); od; time;
1

Assisted-by: Generative AI

ConvertToVectorRep(v, q) for a GF(2) vector v, and CopyToVectorRep(v, q)
for a GF(2) or GF(q0) vector v, with GF(q) a larger field, took the
generic path, which inspects every entry in GAP code. The kernel
rewrites such vectors directly.

Setup:

    gap> L:= List(IdentityMat(600, GF(2)), ShallowCopy);;

Before:

    gap> M:= List(L, v -> CopyToVectorRep(v, 4));; time;
    100
    gap> M:= List(M, v -> CopyToVectorRep(v, 16));; time;
    92
    gap> for v in L do ConvertToVectorRep(v, 4); od; time;
    99

After:

    gap> M:= List(L, v -> CopyToVectorRep(v, 4));; time;
    2
    gap> M:= List(M, v -> CopyToVectorRep(v, 16));; time;
    1
    gap> for v in L do ConvertToVectorRep(v, 4); od; time;
    1

Assisted-by: Generative AI
@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: kernel release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes labels Nov 10, 2026
@fingolfin
fingolfin added this pull request to stack #6824 November 10, 2026 20:47
@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.94737% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.93%. Comparing base (22ae5a8) to head (c48d35d).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
hpcgap/lib/vecmat.gi 57.89% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6817      +/-   ##
==========================================
+ Coverage   79.90%   79.93%   +0.03%     
==========================================
  Files         685      685              
  Lines      295909   296036     +127     
  Branches     8696     8672      -24     
==========================================
+ Hits       236432   236628     +196     
+ Misses      57664    57594      -70     
- Partials     1813     1814       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

HPC-GAP reads its own copy of vecmat.gi, so apply the same fast paths
there.

Assisted-by: Generative AI

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

kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: kernel topic: performance bugs or enhancements related to performance (improvements or regressions)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant