You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm sorry if it's a bit long, but I couldn't replicate this behaviour with anything shorter. The code basically generates all logic expressions with not and implication logic operators given a certain sequence of logic variables. It does so using goroutines as iterators and recursion. Then it prints all of the tautologies among them.
The bug is that when I comment out the fmt.Println call on the line 89, the program finishes in ~3s. When I uncomment it, it finishes in ~2s. So, when printing, it's significantly faster.
I am using:
go version go1.7.6 linux/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
The text was updated successfully, but these errors were encountered:
I can't reproduce this on go1.7, nor on tip. I'm, too, on linux/amd64. On my machine, the code is slightly faster when you don't print.
Can you reproduce this in go1.9beta? go1.7, at this point, is quite old.
ALTree
changed the title
performance bug: goroutine heavy Go program faster when printing, slower when not
runtime: goroutine heavy Go program faster when printing, slower when not
Jun 24, 2017
Ok, so I tried with go1.9beta1 and yes, I can replicate it, but I figured that it only happens in VSCode terminal. When I run the program in normal terminal outside VSCode, the performance is as expected. But inside the VSCode terminal, the performance with printing is faster. This is probably not serious, but very mysterious anyway.
Hi!
I'm encountering a weird performance behaviour with Go, possibly due to Go's goroutine scheduler.
Here's my code: https://play.golang.org/p/a1464VZuIb
I'm sorry if it's a bit long, but I couldn't replicate this behaviour with anything shorter. The code basically generates all logic expressions with not and implication logic operators given a certain sequence of logic variables. It does so using goroutines as iterators and recursion. Then it prints all of the tautologies among them.
The bug is that when I comment out the
fmt.Println
call on the line 89, the program finishes in ~3s. When I uncomment it, it finishes in ~2s. So, when printing, it's significantly faster.I am using:
go version go1.7.6 linux/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
The text was updated successfully, but these errors were encountered: