Go 以非常慢的速度重建tdlib
我为tdlib使用了2个go绑定:每次我在main.go文件中更改一行时,每个绑定都会生成270秒。TDLib是使用gcc构建的。有没有办法不在我每次换行时重建它?我正在为它使用go build-v main.go命令。 我使用来自的指南构建TDLib 我正在建造的例子是Go 以非常慢的速度重建tdlib,go,build,telegram,tdlib,Go,Build,Telegram,Tdlib,我为tdlib使用了2个go绑定:每次我在main.go文件中更改一行时,每个绑定都会生成270秒。TDLib是使用gcc构建的。有没有办法不在我每次换行时重建它?我正在为它使用go build-v main.go命令。 我使用来自的指南构建TDLib 我正在建造的例子是 package main import ( "log" "path/filepath" "github.com/zelenin/go-tdlib/client" ) func main() {
package main
import (
"log"
"path/filepath"
"github.com/zelenin/go-tdlib/client"
)
func main() {
authorizer := client.ClientAuthorizer()
go client.CliInteractor(authorizer)
const (
// apiId = MyApiID from my.telegram.org
// apiHash = "My hash from my.telegram.org"
)
authorizer.TdlibParameters <- &client.TdlibParameters{
UseTestDc: false,
DatabaseDirectory: filepath.Join(".tdlib", "database"),
FilesDirectory: filepath.Join(".tdlib", "files"),
UseFileDatabase: true,
UseChatInfoDatabase: true,
UseMessageDatabase: true,
UseSecretChats: false,
ApiId: apiId,
ApiHash: apiHash,
SystemLanguageCode: "en",
DeviceModel: "Server",
SystemVersion: "1.0.0",
ApplicationVersion: "1.0.0",
EnableStorageOptimizer: true,
IgnoreFileNames: false,
}
logVerbosity := client.WithLogVerbosity(&client.SetLogVerbosityLevelRequest{
NewVerbosityLevel: 0,
})
tdlibClient, err := client.NewClient(authorizer, logVerbosity)
if err != nil {
log.Fatalf("NewClient error: %s", err)
}
optionValue, err := tdlibClient.GetOption(&client.GetOptionRequest{
Name: "version",
})
if err != nil {
log.Fatalf("GetOption error: %s", err)
}
log.Printf("TDLib version: %s", optionValue.(*client.OptionValueString).Value)
me, err := tdlibClient.GetMe()
if err != nil {
log.Fatalf("GetMe error: %s", err)
}
log.Printf("Me: %s %s [%s]", me.FirstName, me.LastName, me.Username)
listener := tdlibClient.GetListener()
defer listener.Close()
for update := range listener.Updates {
if update.GetClass() == client.ClassUpdate {
log.Printf("%#v", update)
}
}
}
是否可以并发构建(不使用1个CPU)?
在重建过程中,它得到了相同的结果,因为我添加了一些新行。我希望它的构建速度比257s快得多,只需一行更改。尝试使用包而不是单个文件正确构建?@JimB仍然无法帮助250秒的重建,尝试文件、包和目录构建,什么都没有changes@FominykhMaxim你找到解决方案了吗?@Kolay.Ne我记不清了,但问题只出现在我的家用电脑上,在另一台电脑上一切正常,仍然不知道问题出在哪里,我猜是某个Go/CGO缓存使用包而不是单个文件正确构建?@JimB无助于250秒重建,尝试文件、包和目录构建,什么都没有changes@FominykhMaxim你找到解决办法了吗?@Kolay.Ne我记不清了,但问题只出现在我的家用电脑上,在其他电脑上一切正常,仍然不知道问题出在哪里,我猜是一些Go/CGO缓存
time go build -v main.go
command-line-arguments
go build -v main.go 257.16s user 9.45s system 99% cpu 4:28.81 total