mirror of
https://github.com/beego/bee.git
synced 2024-11-22 20:20:55 +00:00
optimisation disable GC for go build , go list, go install
+20% speed on large projects
This commit is contained in:
parent
76eb064e69
commit
7210ac621d
4
watch.go
4
watch.go
@ -136,6 +136,7 @@ func Autobuild(files []string, isgenerate bool) {
|
|||||||
icmd := exec.Command("go", "list", "./...")
|
icmd := exec.Command("go", "list", "./...")
|
||||||
buf := bytes.NewBuffer([]byte(""))
|
buf := bytes.NewBuffer([]byte(""))
|
||||||
icmd.Stdout = buf
|
icmd.Stdout = buf
|
||||||
|
icmd.Env = append(os.Environ(), "GOGC=off")
|
||||||
err = icmd.Run()
|
err = icmd.Run()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
list := strings.Split(buf.String(), "\n")[1:]
|
list := strings.Split(buf.String(), "\n")[1:]
|
||||||
@ -146,6 +147,7 @@ func Autobuild(files []string, isgenerate bool) {
|
|||||||
icmd = exec.Command(cmdName, "install", pkg)
|
icmd = exec.Command(cmdName, "install", pkg)
|
||||||
icmd.Stdout = os.Stdout
|
icmd.Stdout = os.Stdout
|
||||||
icmd.Stderr = os.Stderr
|
icmd.Stderr = os.Stderr
|
||||||
|
icmd.Env = append(os.Environ(), "GOGC=off")
|
||||||
err = icmd.Run()
|
err = icmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
break
|
||||||
@ -156,6 +158,7 @@ func Autobuild(files []string, isgenerate bool) {
|
|||||||
|
|
||||||
if isgenerate {
|
if isgenerate {
|
||||||
icmd := exec.Command("bee", "generate", "docs")
|
icmd := exec.Command("bee", "generate", "docs")
|
||||||
|
icmd.Env = append(os.Environ(), "GOGC=off")
|
||||||
icmd.Stdout = os.Stdout
|
icmd.Stdout = os.Stdout
|
||||||
icmd.Stderr = os.Stderr
|
icmd.Stderr = os.Stderr
|
||||||
icmd.Run()
|
icmd.Run()
|
||||||
@ -176,6 +179,7 @@ func Autobuild(files []string, isgenerate bool) {
|
|||||||
args = append(args, files...)
|
args = append(args, files...)
|
||||||
|
|
||||||
bcmd := exec.Command(cmdName, args...)
|
bcmd := exec.Command(cmdName, args...)
|
||||||
|
bcmd.Env = append(os.Environ(), "GOGC=off")
|
||||||
bcmd.Stdout = os.Stdout
|
bcmd.Stdout = os.Stdout
|
||||||
bcmd.Stderr = os.Stderr
|
bcmd.Stderr = os.Stderr
|
||||||
err = bcmd.Run()
|
err = bcmd.Run()
|
||||||
|
Loading…
Reference in New Issue
Block a user