Skip to content

Commit b4d463f

Browse files
committed
Default to GOMAXPROCS=1
1 parent 2a64787 commit b4d463f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: main.go

+12
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"net"
66
"net/http"
77
_ "net/http/pprof"
8+
"os"
9+
"runtime"
810

911
"github.com/jackc/pgproto3/v2"
1012

@@ -14,6 +16,16 @@ import (
1416
)
1517

1618
func main() {
19+
// Performance testing has shown almost a +70% performance boost
20+
// for roundabout just by limiting GOMAXPROCS to 1.
21+
//
22+
// It is possible that it will perform better with more procs in
23+
// certain environments, so we simply change the default here,
24+
// but still respect any override placed in the environment.
25+
if os.Getenv("GOMAXPROCS") == "" {
26+
runtime.GOMAXPROCS(1)
27+
}
28+
1729
log.SetFlags(log.LstdFlags | log.Lshortfile)
1830
frontend.LaunchAll()
1931

0 commit comments

Comments
 (0)