6 ms·
Go is designed for large codebases, which is a problem that the author may not have, and so he may not see the benefits. One key feature is that the Go compile
by jrockway 15y ago
Go is designed for large codebases, which is a problem that the author may not have, and so he may not see the benefits.
One key feature is that the Go compiler itself is the style guide: it automatically reformats your code to remove style guide violations. This makes it easy to work on a codebase the size of Google's because everything looks like it was written by the same person. We try to do the same thing for C++, Java, and Python, but it doesn't work as well because the process is manual.
Similarly, compilation time and runtime for every component, no matter how unimportant, is of utmost importance for Google's codebase. It may not matter how long it takes to run one one-off script, and it may not matter to you how long it takes to compile, but it does matter at Google because we compile every project and run every test after every commit. (OK, builds and tests that are obviously unaffected are skipped. But it's still a lot of code being built and tested.) So your Python project that takes 5 seconds to run tests instead of 1 second ends up wasting decades of CPU time throughout its life time. Same for C++ projects that take many hours to compile. Go tries to be as expressive as Python and run as fast as Java (and compile faster than anything else), and this saves lots of time in aggregate. (Remember, when you break someone's build, the delay between submitting your change and the system knowing about the breakage can result in a lot of hair-pulling for the developers on the project you broke. But if we can know the build is broken before the change is even submitted, then many hours of developer productivity are saved.)
Anyway, don't take this to mean that you're doing software wrong if you don't see the value of Go. Google is a special case and just because we have some problem doesn't mean you should have the same problems. One-man shops should optimize for individual efficiency instead of aggregate efficiency like Google does.
- smanek 15y agoThat's fair - the largest code bases I've ever worked on are all less than ~200K LOC. They've enforced style by mandating committers hook a linter into a git pre-commit hook, and compilation time hasn't been a huge problem since the languages always support incremental/partial compilation (Java/Lisp for the most part). I can imagine that not working at Google-scale.
- adgar 15y ago> They've enforced style by mandating committers hook a linter into a git pre-commit hook Style-related presubmit hooks are a part of every project at Google. Plus readability requirements, etc - style is kept pretty damn consistent. > compilation time hasn't been a huge problem since the languages always support incremental/partial compilation (Java/Lisp for the most part). This is the far more interesting problem to solve at scale with a single centralized repository.
- danieldk 15y agoGo is designed for large codebases, which is a problem that the author may not have, and so he may not see the benefits. Aren't most serious languages designed for large code bases? (and compile faster than anything else), So, why not invest in incremental compilation for an existing language? E.g. the ECJ compiler for Java has done wonders in terms of immediate feedback while developing. clang aims to do the same for C code and slowly makes editors and IDEs more effective. Anyway, don't take this to mean that you're doing software wrong if you don't see the value of Go. I fully agree with the author, on the one hand Go does not provide the performance of C or C++, on the other hand it nearly no useful new abstractions to manage complexity. Languages such as Haskell, OCaml, F# or even D provide a better type system and have similar or better performance. Google is a special case Out of curiosity: how much is Go used in Google? What percentage of new projects use Go compared to e.g. Java or C++?
- mmisu 15y agoI think clang has a good chance to became as competitive as Go for compilation speed. This way you will have a fast compile/run process and the power of C or C++.
- _delirium 15y agoI could believe it for C (tcc is an existence proof for very fast C compilers), but building a C++ compiler of that speed is a pretty difficult task. Separate compilation for templated code is also really hard to get right, since the standard isn't really designed for it and gives few guarantees; if a templated class is changed, determining when you can safely avoid recompiling classes that use it is tough.
- danieldk 15y agoDefinitely. I am anxious to see how much C++11's extern template will improve compilation time, when it will be used by large libraries. Of course it's still a horrible kludge. But the reality is that C++ exists and is widely used ;).
- 15y ago
- EdiX 15y ago> One key feature is that the Go compiler itself is the style guide Unless something changed in the last six months that's not the case, there is a tool called gofmt that will do the reformatting if you call it. I'm not really sure I see publishing a style guideline in the form of code rather than english text makes any difference, at least it didn't make it for my go code. I suspect it has more to do with the fact that some of the developers behind go use acme than anything else.
- drats 15y ago>Go tries to be as expressive as Python and run as fast as Java Why the seemingly almost complete lack of love for Pypy from Google then? It's not like you can stop using Python anytime soon even if you keep extending Go. I believe Google's made one tiny donation to Pypy. Given their benchmarks (http://speed.pypy.org/ http://speed.pypy.org/) and given Google has literally tens of billions in hard cash lying around I can't see how you can't get them some money. A few hundred thousand to Pypy would be justifiable on the performance improvement YouTube would experience alone. Sure the motto is "don't be evil" rather than "do good" but this seems like a no-brainer. Can you give reasons why it's not happening?
- leoc 15y agoI'd guess that C++, Java and NIH are all powerful forces at Google.
- dagw 15y agoGiven that Google hired Guido Van Rossum and that python is one of the three (and up until very recently two) supported languages for GAE, I think we can safely assume the Google isn't entirely anti python.
- protomyth 15y agoHistorically, Sun hired John Ousterhout and that didn't turn out terribly well for TCL backing by Sun.
- dagw 15y agoFair point. Or for a more recent example, Microsoft hiring Simon Peyton-Jones and yet showing no interest in actually using Haskell for anything.
- lclarkmichalek 15y agoWell IIRC, he's employed by Microsoft Research, which is not really the same as Microsoft proper. And they have used some concepts that are core to Haskell, such as LINQ being a monad, and F# is definitely related (though I don't know if that's an official Microsoft language).
- markokocic 15y ago> Go is designed for large codebases, which is a problem that the author may not have, and so he may not see the benefits. If Go is really designed for large code bases, then IDE support for go with code browsing, refactoring, debugging and profiling would be developed in parallel with the Go language itself. Since Go IDE support go only as far as petty Vim and even pettier Emacs modes, I couldn't call go "made for large codebases".
- dhconnelly 15y agohttp://code.google.com/p/goclipse/ http://code.google.com/p/goclipse/
- bh42222 15y agoWe try to do the same thing for C++, Java, and Python, but it doesn't work as well because the process is manual. Use http://astyle.sourceforge.net http://astyle.sourceforge.net and add it to your build process and/or commit or push/pull hooks of your source control. (I am surprised I have to give this tip to anyone on HN!)
- anamax 15y ago> We try [to make all code look like it was written by the same person] for C++, Java, and Python, but it doesn't work as well because the process is manual. However, Python, because space is significant, tends to look fairly similar "in the wild". Add minimum adherence to a style guide and you're pretty close to that goal.