-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/tools/go/packages: bad performance #30677
Comments
This may be too broad of an issue. I believe there are more specific issues already filed which tracks specific areas where performance can be improved. /cc @ianthehat @matloob |
I linked few issues which I found. I found only #29427 which is more specific as it uses cgo in the import path, but for my case it is slow in even for hello world example. |
You should also clarify what Go version you're on. For example, #29382 is making the |
@mvdan Thanks, I added go version which I'm using. I will try master version and update benchmarks. |
The benchmark is also not too fair; you're comparing parsing a single file with loading an entire package. The "before" benchmark should be using something like https://godoc.org/golang.org/x/tools/go/loader to be more realistic, as that too loaded Go packages. I realise your purpose is still to parse a single file on disk. But if that's all you need, I don't think you're ever going to get performance anywhere close to a single In particular, modes like |
Another bit of unfairness I noticed - you're using |
I also forgot about the elephant in the room; your "before" benchmark, even if it uses |
package main
func main() {
}
|
I'm still not sure I understand what you're trying to do. If you just need to parse a file, you should stick to There are probably areas for optimizations and speed-ups in |
@mvdan Thanks, you are right. For parsing a file I will stick to ParseFile and cache go/packages result. I'm closing this issue as there are more specific issues due go/packages performances. |
Problem
There is quite a lot of issues regarding go/packages performance. All tools which a migrating to go modules a going to use x/tools/go/packages which is undesirable slow.
Steps to reproduce
parse_me.go
benchmark_test.go
Results
Is somebody working on it? If not I'm happy to help.
Related issues:
#29758
#29452
#29427
The text was updated successfully, but these errors were encountered: