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
Since Go 1.5, GOMAXPROCS is now set to the number of cores on the machine. When you run go test, Go actually compiles a temp binary that runs each func Test(t *testing.T) in a goroutine. But note that default behavior for Go tests is synchronously - that is, it still runs 1 test at a time.
You've always had the ability to call t.Parallel() before 1.5; but, this was of little use without setting GOMAXPROCS properly. Well now that GOMAXPROCS is set to the number of virtual cores by default, this means t.Parallel() in tests will now make the tests run concurrently.
But using this package you defeat the advantage of running 100s of unit tests concurrently and instead is forced to run each Test harness for a group of Specs - those Specs will run synchronously and thus be slower overall.
The refactoring should make heavy use of goroutines where appropriate, without slowing down simple tests. By moving to use goroutines for most inner loops, we should get the added benefit of increasing performance overall - even without the t.Parallel() flag being set!
Since Go 1.5,
GOMAXPROCS
is now set to the number of cores on the machine. When you rungo test
, Go actually compiles a temp binary that runs eachfunc Test(t *testing.T)
in a goroutine. But note that default behavior for Go tests is synchronously - that is, it still runs 1 test at a time.You've always had the ability to call
t.Parallel()
before 1.5; but, this was of little use without settingGOMAXPROCS
properly. Well now thatGOMAXPROCS
is set to the number of virtual cores by default, this meanst.Parallel()
in tests will now make the tests run concurrently.But using this package you defeat the advantage of running 100s of unit tests concurrently and instead is forced to run each Test harness for a group of Specs - those Specs will run synchronously and thus be slower overall.
The refactoring should make heavy use of
goroutines
where appropriate, without slowing down simple tests. By moving to usegoroutines
for most inner loops, we should get the added benefit of increasing performance overall - even without thet.Parallel()
flag being set!See #4 for details.
The text was updated successfully, but these errors were encountered: