Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Performance 如何提高Golang的编译速度?_Performance_Sqlite_Compilation_Go - Fatal编程技术网

Performance 如何提高Golang的编译速度?

Performance 如何提高Golang的编译速度?,performance,sqlite,compilation,go,Performance,Sqlite,Compilation,Go,我正试图找到一种方法来加快Go程序的编译速度。目前约为30秒,这使得项目的运行速度变慢 当我运行go build-v时,我看到大部分时间都花在编译上(它链接到C sqlite库)。但是,由于这个库从未更改,我想知道是否有可能阻止构建工具每次重新编译它?这可能是由于您升级到go 1.3 我不得不删除$GOPATH/pkg以摆脱旧的(不兼容的)二进制文件 然后它能够再次缓存编译结果尝试go install-a github.com/mattn/go-sqlite3,它将编译后的反go-1.3包安装到

我正试图找到一种方法来加快Go程序的编译速度。目前约为30秒,这使得项目的运行速度变慢


当我运行
go build-v
时,我看到大部分时间都花在编译上(它链接到C sqlite库)。但是,由于这个库从未更改,我想知道是否有可能阻止构建工具每次重新编译它?

这可能是由于您升级到go 1.3

我不得不删除$GOPATH/pkg以摆脱旧的(不兼容的)二进制文件
然后它能够再次缓存编译结果

尝试
go install-a github.com/mattn/go-sqlite3
,它将编译后的反go-1.3包安装到$GOPATH中


现在,您可能已经在
$GOPATH/pkg/
下安装了一个旧版本,因此Go正在为每个版本重新编译它。

在Go 1.10中,无需运行
Go install
等。只需使用
Go build
。新版本使用构建缓存来确定哪些包需要重新编译


查看:

潜在的重复:Go 1.10(2018年第1季度)的编译速度将提高:是的,这就是我在上面的评论中提到的,哦,很抱歉我错过了这个。