Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster SwapMatrixRows and SwapMatrixColumns for 8bit matrices #5838

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

fingolfin
Copy link
Member

Before:

gap> mat:=IdentityMat(10,GF(5));; ConvertToMatrixRep(mat);; mat;
< mutable compressed matrix 10x10 over GF(5) >
gap> for i in [1..1000000] do SwapMatrixColumns(mat,1,2); od; time;
1308
gap> for i in [1..1000000] do SwapMatrixRows(mat,1,2); od; time;
125
gap> for i in [1..1000000] do tmp:=mat[1];mat[1]:=mat[2];mat[2]:=tmp; od; time;
92

After:

gap> mat:=IdentityMat(10,GF(5));; ConvertToMatrixRep(mat);; mat;
< mutable compressed matrix 10x10 over GF(5) >
gap> for i in [1..1000000] do SwapMatrixColumns(mat,1,2); od; time;
198
gap> for i in [1..1000000] do SwapMatrixRows(mat,1,2); od; time;
28
gap> for i in [1..1000000] do tmp:=mat[1];mat[1]:=mat[2];mat[2]:=tmp; od; time;
92

Please provide a short summary of this PR and its purpose here. E.g., does it add a new feature, and which? Does it fix a bug, and which? If there is an associated issue, please list it here.

Text for release notes

We track noteworthy changes as entries in the CHANGES.md file in the root directory of this repository. To help us decide whether and how to describe your PR, please do one of the following:

  1. If this PR shall not be mentioned in the release notes, write "none" here.
  2. If a brief note suffices, edit the title of this PR to be usable as entry in CHANGES.md, and write "see title" here (or if you have the required permissions, add the label release notes: use title to this PR and remove this section)
  3. If a longer note is needed, just write it here, ideally following the general style used in that file

Further details

If necessary, provide further details down here.

Before:

    gap> mat:=IdentityMat(10,GF(5));; ConvertToMatrixRep(mat);; mat;
    < mutable compressed matrix 10x10 over GF(5) >
    gap> for i in [1..1000000] do SwapMatrixColumns(mat,1,2); od; time;
    1308
    gap> for i in [1..1000000] do SwapMatrixRows(mat,1,2); od; time;
    125
    gap> for i in [1..1000000] do tmp:=mat[1];mat[1]:=mat[2];mat[2]:=tmp; od; time;
    92

After:

    gap> mat:=IdentityMat(10,GF(5));; ConvertToMatrixRep(mat);; mat;
    < mutable compressed matrix 10x10 over GF(5) >
    gap> for i in [1..1000000] do SwapMatrixColumns(mat,1,2); od; time;
    198
    gap> for i in [1..1000000] do SwapMatrixRows(mat,1,2); od; time;
    28
    gap> for i in [1..1000000] do tmp:=mat[1];mat[1]:=mat[2];mat[2]:=tmp; od; time;
    92
@fingolfin fingolfin added topic: performance bugs or enhancements related to performance (improvements or regressions) topic: kernel release notes: added PRs introducing changes that have since been mentioned in the release notes labels Nov 11, 2024
@fingolfin fingolfin changed the title Fast SwapMatrixRows/columns for 8bit matrices Faster SwapMatrixRows and SwapMatrixColumns for 8bit matrices Nov 13, 2024
@fingolfin fingolfin merged commit 2dc0929 into gap-system:master Nov 13, 2024
33 checks passed
@fingolfin fingolfin deleted the mh/swap-rows-cols-8bit branch November 13, 2024 08:14
@fingolfin fingolfin added release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes and removed release notes: added PRs introducing changes that have since been mentioned in the release notes labels Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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