Re:Compile Go programs 7x faster
by jerf on Wednesday August 10, 2016 @09:09AM
(#12261360)
After reading this discussion and the source of the project, I've flagged this. This "compile Go faster" project really is just about 5 lines of modestly useful bash, and even as someone who often complains people tend to overstate the uselessness of benchmarks, those benchmarks are truly useless. Along with being too small to measure anything useful, almost certainly being dominated by startup overhead, you can't benchmark two fundamentally different things like that. Incremental builds, regardless of language, are not "3x faster" or "9x faster", they're doing fundamentally less work. It's not quite correct to say they're in a different O() class, but that's at least the right sort of thought. O(n^2) algorithms aren't any number of "x" times faster than a O(n^3) algorithm, they're more fundamentally faster than that metric can capture; similarly here.
To the author, I'm not complaining that you have this on github per se, but you may want to make it more clear what's going on here if you're going to submit it to HN. For instance, this is one of those projects where you could literally inline the source into the README.md. And I'd drop the benchmarks, those really aren't useful. Or at least drop the "x times faster" column.
Re:Compile Go programs 7x faster
by jerf on Wednesday August 10, 2016 @11:20AM
(#12262395)
The "it could create good comments" is not a good metric for not flagging something, because there is no link for which that is not true, or at least someone would argue for it.
While I again want to emphasize I'm not really being that critical of the author for creating it, because people are welcome to put whatever they want on github, it's a thin piece of content whose thin content is also somewhat misleading, that was upvoted to the top of HN. I'm still comfortable with this, barring the admin staff disagreeing with me.
Re:Compile Go programs 7x faster
by tptacek on Wednesday August 10, 2016 @11:54AM
(#12262666)
That's true for off-topic stories, which stories are the actual purpose of the flag button. It's not true for stories we simply disagree with. In this case, you happen to be right, but everyone has a bunch of topics they believe themselves to be right about.
Re:Compile Go programs 7x faster
by shazow on Wednesday August 10, 2016 @11:15AM
(#12262366)
The length of code of a program should not be a metric for how useful or valid it is.
This is a great shortcut for something that I've been doing manually for years and I'm happy to have stumbled on it and the surrounding discussion. Please don't flag stories like this.
Re:Compile Go programs 7x faster
by nemild on Wednesday August 10, 2016 @09:57AM
(#12261737)
I have to echo everything said by @jerf. One additional suggestion is to write a blog post highlighting ways to improve the workflow for go developers and help them to understand why certain things are better than others, as your work here slots in nicely.
You could also explain in detail what goes on behind the scenes in an incremental build.
Re:Compile Go programs 7x faster
by nickcw on Wednesday August 10, 2016 @07:55AM
(#12260956)
Yes, never use go build, always use go install!
go build builds everything, whereas go install does an incremental build on the stuff that has changed and installs it (either in GOPATH/bin or GOPATH/pkg).
Re:Compile Go programs 7x faster
by ithkuil on Wednesday August 10, 2016 @09:43AM
(#12261627)
FYI, there is also `go build -i`, which is behaves like `go build` in terms of what executable artefacts it produces and where it puts them (i.e. it doesn't install stuff in $GOPATH/bin) but preserves object files for all the dependent packages like `go install` does
Re:Compile Go programs 7x faster
by GickRimes on Wednesday August 10, 2016 @08:54AM
(#12261267)
Did not think compiling Go programs was that much of an issue. Many texts reference the fact that the whole standard library can be compiled in sub 10sec.
Re:Compile Go programs 7x faster
by bjourne on Wednesday August 10, 2016 @08:30AM
(#12261132)
Maybe I'm daft, but his table says 502 lines in 1.558 seconds. So 322 lines/second. I thought the Go compiler was supposed to be amazingly fast? That is not fast at all.
Re:Compile Go programs 7x faster
by IanCal on Wednesday August 10, 2016 @09:23AM
(#12261474)
There's a flag for it, which didn't make a difference (edit - with the new 1.7 compiler it does, but it goes from half that speed to the same figure). Even with a perfect scaling, I'd be about 10x behind a post from 7 years ago.
Perhaps it's compiling a lot more lines than I think? Lots of bits of the standard library I should be including in the line count?
Re:Compile Go programs 7x faster
by merb on Wednesday August 10, 2016 @01:54PM
(#12263597)
actually I guess stdlib is compiled, too. But golang before 1.5 was faster to compile.
I just wonder how much difference it would make with multicore's. I mean scala beats down my new Xeon E5-2670 workstation on all threads.
To the author, I'm not complaining that you have this on github per se, but you may want to make it more clear what's going on here if you're going to submit it to HN. For instance, this is one of those projects where you could literally inline the source into the README.md. And I'd drop the benchmarks, those really aren't useful. Or at least drop the "x times faster" column.
While I again want to emphasize I'm not really being that critical of the author for creating it, because people are welcome to put whatever they want on github, it's a thin piece of content whose thin content is also somewhat misleading, that was upvoted to the top of HN. I'm still comfortable with this, barring the admin staff disagreeing with me.
This is a great shortcut for something that I've been doing manually for years and I'm happy to have stumbled on it and the surrounding discussion. Please don't flag stories like this.
You could also explain in detail what goes on behind the scenes in an incremental build.
go build builds everything, whereas go install does an incremental build on the stuff that has changed and installs it (either in GOPATH/bin or GOPATH/pkg).
Shouldn't "go build" just do incremental builds and be faster across the board?
guilty. typing in "go run" for quick scripts is one hard to conquer habit ;)
Apparently there are some optimizations coming up on newer versions.
https://talks.golang.org/2012/splash.article
So I am wondering too what this is all about.
Source: https://www.youtube.com/watch?v=WxyyJyB_Ssc
That would be a slowdown of like 4x to current javac, I guess his computer is just not good enough?
Edit - this blogpost has a 18k lines/s though, I wonder what the differences are?
http://ptspts.blogspot.co.uk/2009/11/how-fast-does-8g-in-goo...
Perhaps it's compiling a lot more lines than I think? Lots of bits of the standard library I should be including in the line count?
I rarely use `go build`. `go install` always faster.
`goinstall` predates the entire `go` tool.