1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-11-19 06:30:29 +01:00

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

View File

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