Re:GoPar: Automatic Loop Parallelization of Go Programs
by JulianMorrison on Sunday May 05, 2013 @11:16PM
(#5660743)
It's cute, but the work to manually parallelize is pretty light in Go.
var a []X
...
done := make(chan bool)
b := make([]Y,len(a))
for i, _ := range a {
go func (j int){
b[j] = process(a[j])
done <- true
}(i)
}
for n:=0; n<len(a); n++ { _ = <-done }
Re:GoPar: Automatic Loop Parallelization of Go Programs
by wetherbeei on Sunday May 05, 2013 @11:24PM
(#5660757)
"Such is modern computing: everything simple is made too complicated because it’s easy to fiddle with; everything complicated stays complicated because it’s hard to fix." - Rob Pike
The point is your code is very verbose compared to the original, and anyone will take at least twice as long trying to figure out the interaction between channels and goroutine launches vs the sequential version.
The point is your code is very verbose compared to the original, and anyone will take at least twice as long trying to figure out the interaction between channels and goroutine launches vs the sequential version.
for i, v := range a { a[i] = process(v) }