GoClipse / goclipse

Eclipse IDE for the Go programming language:
http://goclipse.github.io/
Eclipse Public License 1.0
841 stars 287 forks source link

Compilation is very slow? #64

Closed AlexLuya closed 10 years ago

AlexLuya commented 10 years ago

Does goclipe do increment compilation?I found even a tiny change,it will trigger a long time complilation.Is it normal?

sesteel commented 10 years ago

The compilation strategy is to follow the dependency chain in reverse. Currently, we build each package along that path which is a package in your project. We do this to find other areas that may be broken by your modifications, rather than just building the package you touched. I may modify this, however, now that I'm thinking about it.

I suspect having deeply nested package structures in go is not very common. I don't remember anybody complaining about this before. On Aug 7, 2014 3:33 AM, "Alex Luya" notifications@github.com wrote:

Does goclipe do increment compilation?I found even a tiny change,it will trigger a long time complilation.Is it normal?

— Reply to this email directly or view it on GitHub https://github.com/GoClipse/goclipse/issues/64.

baconalot commented 10 years ago

I also sometimes have a long compilation time, but that is largely due to the number of projects under the gopath (10 own projects and 20+ external projects). These compilation times are especially cumbersome when changing a (nested) utility function that is used in multiple projects. Cant see how to change this without dropping the full compilation support, which is the main usp for me to use goclipse.

bruno-medeiros commented 10 years ago

I did some investigation on this issue, and now I'm a bit confused.

@sesteel It seems GoClipse does incremental compilation, that much I knew. And it builds the "dependees" that have become out of date when their dependencies have changed, like you just said.

However, 'go build'/'go install' has built in incremental compilation as well, correct? - Well, as long as you install the packages as well and not just do 'go build'. Basically, you can call go install all and Go will build all the packages in your GOPATH tree, but only if there has been modifications in the sources file. This is what my experiment showed. And yes, if a package B depends on another package A that is to be rebuilt, then package B will be rebuilt as well, and so on.

Is the GoClipse built-in incremental builder a remnant of a time before 'go build'/'go install' was available?

sesteel commented 10 years ago

From my understanding, yes. It should be a fairly simple fix to run a go install ./...

On Fri, Sep 12, 2014 at 4:52 PM, Bruno Medeiros notifications@github.com wrote:

I did some investigation on this issue, and now I'm a bit confused.

@sesteel https://github.com/sesteel It seems GoClipse does incremental compilation, that much I knew. And it builds the "dependees" that have become out of date when their dependencies have changed, like you just said.

However, 'go build'/'go install' has built in incremental compilation as well, correct? - Well, as long as you install the packages as well and not just do 'go build'. Basically, you can call go install all and Go will build all the packages in your GOPATH tree, but only if there has been modifications in the sources file. This is what my experiment showed. And yes, if a package B depends on another package A that is to be rebuilt, then package B will be rebuilt as well, and so on.

Is the GoClipse built-in incremental builder a remnant of a time before 'go build'/'go install' was available?

— Reply to this email directly or view it on GitHub https://github.com/GoClipse/goclipse/issues/64#issuecomment-55470462.

bruno-medeiros commented 10 years ago

Hum, I see. I think in the future it might be better to switch to just using go install all and drop the built-in builder... I don't think it's worthwhile to have an IDE-specific incremental builder.

However, it's worth taking a quick look at possible performance differences. @baconalot and @AlexLuya : can you try running go install all on your big Go workspace, do a change on an utility function, run go install all again, and compare the speed of that with running the GoClipse built-in builder under the same scenario? (BTW, to compare against a Go Eclipse project, you should run go build like this: export GOPATH=<Eclipse Go project path>; go install all . It doesn't have to be precise measurement, but I'm looking to get a ballpark figure to see if they are similar or not.

(Also I wonder if the go package file format saves packages dependencies in its metadata. If not, the GoClipse built-in builder might have a small advantage here as it can cache the dependency tree.)

baconalot commented 10 years ago

Here are my metrics:

Eclipse build: -disable eclipse autobuild -rm $GOPATH/bin/* -touch file X.go -eclipse "build all" -ls $GOPATH/bin/ Results in: -13 sec build time -only binaries that are dependent on X.go have been build

Go install all build -rm $GOPATH/bin/* -touch file X.go -cd $GOPATH -go install all -ls $GOPATH/bin/ Results in: -3 sec build time -all binaries in gopath have been build

Conclusion It looks like go install all is the way to go.

Qubitium commented 10 years ago

+this...We are having the same issue where the goclipse build takes forever versus go install which is extremely fast.

AlexLuya commented 10 years ago

I am pretty sure this problem comes from goclipse.because same code base complied extremely fast by go install

AlexLuya commented 10 years ago

According to the compilation output in console,it seems that same package will be built multiples time or there is compilation dead loop. Right now,compilation has been running more than 30 minutes,and I have tried to kill eclipse,then reopen it,compilation keeps running after reopening,In the before,I can kill compilation in progress view,but right now,I can't find corresponded progress to kill.That kills me.

bruno-medeiros commented 10 years ago

@AlexLuya Have you tried that with Goclipse 0.8.1 ? Previous to that, there was a bug that omitted the display of several build commands in the build console, so it was unclear what the build was doing. Now all invoked commands should be displayed.

But, in any case, the plans for the future should be to remove the built-in incremental builder entirely, and just use go install all. This is high priority, likely the next Goclipse task I'll work on, as well as #84 .

AlexLuya commented 10 years ago

Yes,I am using 0.8.1

AlexLuya commented 10 years ago

And I think 0.8.1 takes a serious bug in:If some compilation errors exist,compilation drop into dead loop,more serious problem is, even eclipse got killed,go compilation won't die with it,more and more compilation progresses keep getting generated automatically,there isn't way to kill them all,so I must restart system.

bruno-medeiros commented 10 years ago

Fixed in master