3 ms·
What are you talking about? Go doesn't parallelize its loops, in fact, concurrent mutating iteration is unsafe. Reads of memory locations larger than a sin
by Joker_vD 3y ago
What are you talking about? Go doesn't parallelize its loops, in fact, concurrent mutating iteration is unsafe.
Reads of memory locations larger than a single machine word are encouraged but not required to meet the same semantics as word-sized memory locations, observing a single allowed write w. For performance reasons, implementations may instead treat larger operations as a set of individual machine-word-sized operations in an unspecified order. This means that races on multiword data structures can lead to inconsistent values not corresponding to a single write. When the values depend on the consistency of internal (pointer, length) or (pointer, type) pairs, as can be the case for interface values, maps, slices, and strings in most Go implementations, such races can in turn lead to arbitrary memory corruption.
The for-range in Go doesn't introduce any synchronization points.
- rurban 3y agoYou cited something else. They don't yet parallelize loops, but the idea was there. Most others do it already
- Joker_vD 3y agoIf you mean OMP-style for loops, they most likely won't add them: [0]. [0] https://github.com/golang/go/issues/24210#issuecomment-369793380 https://github.com/golang/go/issues/24210#issuecomment-36979...