summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-06-01 20:53:03 +0200
committerJakob Unterwurzacher2017-06-01 20:55:13 +0200
commit53b7c17261dbf0aeb46ebb448f7c97d5c9fad986 (patch)
treeb5213f87c037d4008a66309732962b61b97a9a22 /main.go
parentf44902aaaeb8f60060c2f852b66962eca1df6b99 (diff)
Don't cap GOMAXPROCS at 4.
Before Go 1.5, GOMAXPROCS defaulted to 1, hence it made sense to unconditionally increase it to 4. But since Go 1.5, GOMAXPROCS defaults to the number of cores, so don't keep it from increasing above 4. Also, update the performance numbers.
Diffstat (limited to 'main.go')
-rw-r--r--main.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/main.go b/main.go
index 9b0e31b..58d5e06 100644
--- a/main.go
+++ b/main.go
@@ -11,6 +11,8 @@ import (
"strings"
"time"
+ "github.com/hanwen/go-fuse/fuse"
+
"github.com/rfjakob/gocryptfs/internal/configfile"
"github.com/rfjakob/gocryptfs/internal/contentenc"
"github.com/rfjakob/gocryptfs/internal/exitcodes"
@@ -18,7 +20,6 @@ import (
"github.com/rfjakob/gocryptfs/internal/speed"
"github.com/rfjakob/gocryptfs/internal/stupidgcm"
"github.com/rfjakob/gocryptfs/internal/tlog"
- "github.com/hanwen/go-fuse/fuse"
)
// GitVersion is the gocryptfs version according to git, set by build.bash
@@ -111,7 +112,11 @@ func printVersion() {
}
func main() {
- runtime.GOMAXPROCS(4)
+ mxp := runtime.GOMAXPROCS(0)
+ if mxp < 4 {
+ // On a 2-core machine, setting maxprocs to 4 gives 10% better performance
+ runtime.GOMAXPROCS(4)
+ }
var err error
// Parse all command-line options (i.e. arguments starting with "-")
// into "args". Path arguments are parsed below.