Multiple GoRouting version slower

Hi,

I have a program that generates a Mandlebrot image.
A single goroutine version takes 20ish seconds.
A multiple goroutine version takes 30ish seconds.
Both produce identical results.
I can see one core maxed out in the single version, and all the cores maxed out in the multiple one.
I’ve checked it’s not a GC issue (using GODEBUG=gctrace=1 go run main.go ) as there is no garbage after the setup.
There is no use of math.rand

Where should I be looking to discover why it’s not running faster?

Thanks

Hmm … yet another ask the question THEN find the answer! (The universe is weird! :slight_smile:

Anyway, the answer for me …
go run -race main.go

I had a global variable that was counting the number if iterations inside the actual work routine. After removing that, the multiple goroutine version finished is 4ish seconds. Yay.

So the new question … the go compiler silently adds some synchronization work when it finds some race conditions?
It seems the answer is obviously yes … but maybe something else is going on?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.