本文介绍了在Windows中,golang速度很慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
package main
import "fmt"
func main() {
fmt.Println("Hello world")
}
该命令为 go a.go
.
此代码在Windows中需要4〜5s.
The command is go run a.go
.
This code need 4~5s in windows.
推荐答案
我相信 go run
会编译代码,然后运行它.众所周知,Go 1.5的编译速度要慢得多.(请阅读发行说明)开发人员已将其全部转换为Go代码,但尚未针对Go进行优化.
I believe that go run
compiles the code and then runs it. Go 1.5 is known to be much slower at compiling. (Read the release notes) The devs have converted it all to Go code but haven't optimized it for Go yet.
Go也使用POSIX样式的磁盘和网络操作.我不相信有人为完成端口和Windows异步IO优化了Go.
Also Go uses POSIX style disk and network operations. I don't believe anyone has optimized Go for completion ports and Windows asynch IO.
这篇关于在Windows中,golang速度很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!