Potential to modify ordering for split_count and tour_counter
wang384670111 opened this issue · comments
Lines 113 to 115 in 990841b
SeqCst
is overly restrictive. I believe that the ordering can be appropriately modified.
In par_bridge
model, I believe that split_count
is just a counter across threads and does not synchronize with other locals. Therefore, using Relaxed
ordering should suffice.
rayon/rayon-demo/src/tsp/solver.rs
Line 67 in 990841b
Similarly, In solver
model, tour_counter
is just a counter across threads, using Relaxed
ordering should suffice.
(happy to make a PR if this looks reasonable)
It's been this way in par_bridge
since it was first added in #550, but I don't think we paid much attention to that ordering. I agree that Relaxed
should be fine, but I also think it won't make much difference, as this only executes once per thread for a given par_bridge
. The real contention comes when they all wait on the same Mutex<Iter>
.
The tsp counter is fine to change too. You're welcome to make a PR!
Related Link for PR:
#1140