asynchronously compute images in == for Automorphisms

This commit is contained in:
kalmarek 2020-10-07 02:40:18 +02:00
parent 38fbed7f76
commit 1c659d5216
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
1 changed files with 14 additions and 7 deletions

View File

@ -256,13 +256,20 @@ function (==)(g::Automorphism{N}, h::Automorphism{N}) where N
@assert !ismodified(g) && !ismodified(h) @assert !ismodified(g) && !ismodified(h)
# cheap # cheap
hash(g) != hash(h) && return false # hashes differ, so images must have differed as well # if hashes differ, images must have differed as well
# equal elements, or possibly hash conflict hash(g) != hash(h) && return false
if !img_c # equal elements, or possibly a hash conflict
img = compute_images(g) begin
end if !img_computed
if !imh_c img_task = Threads.@spawn img = compute_images(g)
imh = compute_images(h) # img = compute_images(g)
end
if !imh_computed
imh_task = Threads.@spawn imh = compute_images(h)
# imh = compute_images(h)
end
!img_computed && fetch(img_task)
!imh_computed && fetch(imh_task)
end end
return img == imh return img == imh
end end