-
Notifications
You must be signed in to change notification settings - Fork 548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gop compiler is much slower than go #1710
Comments
This is mainly due to the performance of the import function (by https://pkg.go.dev/golang.org/x/tools). This has been solved before, but the burden was relatively heavy, so we gave up the optimization later. After v1.2.0 is released, we will pick up performance optimization again. 这个主要是由于 import 功能的性能导致,这个之前曾经解决过,但是负担比较重所以后来放弃了优化,在 v1.2.0 发布后,接下来我们会把性能优化重新捡起来。 |
I use a mac, but it's not as exaggerated as you said. There may be other reasons why Windows is slow. % cat t.gop age := 10
echo "age = ${age}" % time gop run t.gop
gop run t.gop 0.39s user 0.85s system 85% cpu 1.448 total |
Thank you for your reply, Xu Da. I also tested on Win10's WSL, and the performance was slightly better. Here are the results:
Then I tested the same command using PowerShell:
感谢许大的回复,我也在Win10的WSL下做了测试,性能稍好一些,如下:
real 0m2.585s 然后我用PowerShell再做了同样命令的测试,如下:
Days : 0 我没开杀毒软件,推测可能gop对Win系统的某些调用还能再优化 |
The compilation speed of the latest version of Go+ has also been improved a lot. Compiling the complete Go+ tutorial (https://github.com/goplus/tutorial) has been increased by 50 times, and compiling all examples from the spx repository (https://github.com/goplus/spx) is also 10x faster. At present, two things related to import are mainly optimized: 1) share importer, so that all projects import the same pkg only happen once. 2) Significantly improve the performance of Go+ init package and reduce a large number of unnecessary repeated checks. |
我通过源码编译的新版本,似乎性能没有变化,很奇怪:
|
This optimization is not related to windows. |
when gop build The following program
a.gop
triggers an long long timegop use over 5 sec, and 'go build' only use 1 sec
Got
gop build
Gop Version
1.1.13或1.2都试过
Additional Notes
在Win10、Win7都试过。我认为go+语言很好,但也不至于编译性能与go相比下降这么多,是不是我这边的环境问题?为了检查性能,我修改了gop.go代码,加上了pprof,但看不出什么问题。
a.cpuprofile
runtime.cgocall
C:\Program Files\Go\src\runtime\cgocall.go
Total: 12.07s 12.07s (flat, cum) 99.83%
The text was updated successfully, but these errors were encountered: