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

feat: make _canonical_matrix faster #4117

Merged
merged 3 commits into from
Sep 20, 2024
Merged

feat: make _canonical_matrix faster #4117

merged 3 commits into from
Sep 20, 2024

Conversation

thofma
Copy link
Collaborator

@thofma thofma commented Sep 19, 2024

Some low-hanging fruit.

Before:

julia> @time Oscar.Orderings._canonical_matrix(w);
  1.322101 seconds (21.72 M allocations: 826.664 MiB, 14.43% gc time)

After:

julia> @time Oscar.Orderings._canonical_matrix(w);
  0.021654 seconds (3.57 k allocations: 2.066 MiB)

There is still some room for improvement.

@HechtiDerLachs
Copy link
Collaborator

HechtiDerLachs commented Sep 19, 2024

Cool, thanks! Definitely an improvement. But as you say: Still room for further improvement, eventually.

HechtiDerLachs
HechtiDerLachs previously approved these changes Sep 19, 2024
src/Rings/orderings.jl Outdated Show resolved Hide resolved
@thofma
Copy link
Collaborator Author

thofma commented Sep 19, 2024

I guess I messed something up.

How fast is your sparse version?

@HechtiDerLachs
Copy link
Collaborator

How fast is your sparse version?

My sparse version never became functional, unfortunately. I also messed things up and didn't know how to resolve it.

@HechtiDerLachs HechtiDerLachs dismissed their stale review September 19, 2024 12:32

Tests fail at the moment.

@joschmitt
Copy link
Member

joschmitt commented Sep 19, 2024

I pushed a fix for the sparse version. I now get these timings:

# This PR:
julia> @btime Oscar.Orderings._canonical_matrix(M);
  9.841 ms (4095 allocations: 2.09 MiB)

# 4114:
julia> @btime Oscar.Orderings._canonical_matrix(M);
  5.179 ms (260187 allocations: 4.11 MiB)

EDIT: new version of #4114

julia> @btime Oscar.Orderings._canonical_matrix(M);;
  1.505 ms (6669 allocations: 247.57 KiB)

src/Rings/orderings.jl Outdated Show resolved Hide resolved
Copy link

codecov bot commented Sep 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.68%. Comparing base (b5d0b43) to head (81ee7ee).
Report is 10 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4117      +/-   ##
==========================================
+ Coverage   84.66%   84.68%   +0.01%     
==========================================
  Files         626      626              
  Lines       84210    84270      +60     
==========================================
+ Hits        71300    71360      +60     
  Misses      12910    12910              
Files with missing lines Coverage Δ
src/Rings/orderings.jl 97.58% <100.00%> (+0.01%) ⬆️

... and 12 files with indirect coverage changes

@@ -87,7 +87,7 @@ struct MatrixOrdering <: AbsGenOrdering
end
end

function _canonical_matrix(w)
function __canonical_matrix(w)
Copy link
Member

Choose a reason for hiding this comment

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

this is no longer used and should be removed (before merging this)

@fingolfin fingolfin enabled auto-merge (squash) September 20, 2024 11:21
@fingolfin fingolfin merged commit 8ec068b into master Sep 20, 2024
29 checks passed
@fingolfin fingolfin deleted the th/canmat branch September 20, 2024 13:00
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.

5 participants