18 ms·
The State of Go: Where we are in February 2016
- BenoitP 11y agoThe Go runtime is really starting to look sexy. 20 ms GC pauses on 200+ GB heaps! I remember a thread discussing a pauseless GC on the dev mailing-list; where Gil Tene, of Azul C4's fame, commented on having a clear policy on safepoints from the beginning was paramount to having a good GC. It looked like the community is very biased towards doing the fundamental things well, and attracting the right people. And on top of that we're get BLAS and LAPACK bindings from https://github.com/gonum https://github.com/gonum
- rhodysurf 11y agoOh wow thanks for pointing out gonum! Definitely going to be playing around with this.
- deleted 11y ago[deleted]
- amelius 11y agoThe only thing missing is a good binding to a javascript engine, for code that has to run on both client and server.
- nulltype 11y agoIf you need to write code that runs on your go server and on the client, there's always https://github.com/gopherjs/gopherjs https://github.com/gopherjs/gopherjs
- amelius 11y agoThat is nice. But I hope that you understand that such a solution is not always preferred in every situation. For example, for performance reasons, it is always better to code in the native language.
- mike_hearn 11y agoYou have to be very careful about these sorts of GC statistics. Things are often not quite what they seem and they depend a lot on the type of app you run. The first thing to be aware of is that with modern collectors (I have no idea how modern Go's new collector is though), GC pause time depends on how much live data there is in the young generation. So you can easily have enormous heaps with very low pause times if all your objects die young and hardly ever make it into the old generations, because then you never really need to collect the rest of the heap at all. Of course, outside of synthetic benchmarks, many apps don't show such pleasant behaviour, and often GC algorithms face difficult tradeoffs that are only really knowable by the developers. For instance, do you want low pause times, or less CPU used by the collector (higher throughput)? It turns out that's a fundamental tradeoff and the right answer usually depends whether your app is a user facing server (needs low pause times) or a batch job (better to pause for long periods but complete faster). No runtime can know that, which is why the JVM has tons of tuning knobs. Left to its own devices you can theoretically get away with only tweaking a single knob which is target pause time (in G1). Set it lower and CPU usage of the collector goes up but it'll try and pause for less time. Set it higher and the collector gets more efficient. Or you can just buy Zing and get rid of GC pauses entirely. So a stat by itself like "20ms GC pauses on 200GB heaps" doesn't mean much by itself. You can get very low pause times with huge heaps out of the JVM as well: http://www.slideshare.net/HBaseCon/dev-session-7-49202969 but of course, you have to pay the piper somehow ... assuming non-weird heap usage the program will run slower overall.
- eloff 11y agoGo doesn't use a generational GC AFAIK.
- _ph_ 11y agoThe GO gc is not generational, those 20ms are for a full gc. Certainly the details of the heap usage of the application is going to affect gc times, but this is not the time for just a nursery collection.
- mike_hearn 11y agoOK, the tradeoff they're making that I missed is that it's not a compacting collector. So eventually your heap can fragment to the point where allocation gets expensive or impossible. Unusual design choice.
- FenugreekAcerb 11y agoWhy is there a "women who go" and not a "men who go"? EDIT: Just to be clear, I don't have nothing against women. I just think that treating them "differently" is not the solution. The moment you treat them differently you are discriminating.
- jcadam 11y agoeverybody goes.
- FenugreekAcerb 11y agothen call it people who go. I'm tired of this politically correct shit.
- abiox 11y agois this kind of like "why is there a black history month and not a white history month"?
- FenugreekAcerb 11y agohttps://en.wikipedia.org/wiki/Black_History_Month#Criticism https://en.wikipedia.org/wiki/Black_History_Month#Criticism
- skj 11y agoBecause when a man goes, no one looks at him funny.
- mrweasel 11y ago{{range . -}} <li>{{.}}</li> {{end -}} This seems like a bit of a hack to be honest. Would anything break if {{range .}} <li>{{.}}</li> {{end}} worked as expected?
- masklinn 11y agoIt would become unusable for general-purpose text templating[0], and would either break interspersing dynamic text ("this is {{ name }}" with name=Bob would be rendered as "this isBob") within static text or would need a semantic understanding of HTML. And even then the presence or absence of whitespace in HTML does have rendering impacts (though I don't remember one offhand — aside from linebreaks — it's been a long time since I last hit one), so the template author must be able to control it and importantly to keep whitespace present between static and dynamic items. [0] html/template is a relatively thin layer over text/template with built-in XSS security where the original does "raw" output by default
- Sir_Cmpwn 11y agoWhitespace inserts a text node in the DOM. I think.
- masklinn 11y agoWhitespace is text, yes?
- mrweasel 11y agoI just think that a simpler solution would be to always ignore the first line break after the range begin and end tags. I can't really see the case where that would cause an issue, if you REALLY do need the "extra" line break just put it inside the range. Whitespaces shouldn't be touched, just parse them though and don't process them. That would make the templates look more like those of Django and Jinja2, which most seem comfortable with.
- masklinn 11y ago
- siscia 11y agoHow the Go GC does comparing with the JVM one ?
- omginternets 11y agoIn terms of what? Latency? I think Go is down to something like 10ms, and from what I understand, pressure on the GC can be relieved by using things such as `sync.Pool`.
- vardump 11y agoJVM's gc is most likely significantly better. On the other hand golang's gc needs to collect less objects, in some cases orders of magnitude less. If you compare a slice of structs with 1000 elements, it'll be one object (and allocation) in golang. Equivalent array in JVM requires the array itself + 1000 Objects, 1001 allocations. In this case, golang has lot less object graph to gc. Of course slice of 1000 interfaces or pointers faces the same 1001 issue in golang as well. You could emulate same gc load cost in JVM at cost of runtime performance by storing the objects in a byte array and [de]serialize as needed, but that's neither idiomatic or acceptable solution most of the time.
- pjmlp 11y agoHopefully Java will get value types around version 10, but that is still quite far away. In the meantime, Azul and IBM JVMs JITs are able to optimize "value types" if the classes follow certain patterns or with some annotation help.
- aardvark179 11y agoYeah, and they can collect the unreachable objects in the array when no references exist to the array itself. From the QCon talk linked to in the slides it sounds like the Go GC is benefiting from the reduced number of objects being allocated and the fact that those objects can never move. Makes things a lot simpler if you can get away with it, but I can imagine a reference into an array, and the inability to move objects could combine in bad ways if you're unlucky.
- dantillberg 11y agoThe concurrent map access checks in Go1.6rc1 have already uncovered one such bug in my code. Love it! Oh, and I've already made use of the whitespace-stripping in text templates, too! :) One thing I was worried about from the focus on reducing maximum GC pause times (i.e. latency) was that this might negatively affect GC throughput. For example, maybe the pauses are shorter but there are many more of them. The project I'm working on at the moment exercises the GC heavily but is not concerned with latency (it's bulk data-processing), and I didn't see any significant regression in performance/throughput from 1.5 to 1.6rc1. So, yay.
- mwsherman 11y agoBased on Rick’s talks, this is the sort of trade-off choice one deliberately makes. Reduced throughput can be understood as amortized GC.
- zellyn 11y agoAs I understand it, you would have seen the performance hit going from 1.4 to 1.5.
- pcwalton 11y agoAggressive GC latency improvements, like the ones Go is making, virtually always negatively affect throughput. For example, Azul C4 has lower throughput than HotSpot (at least per the numbers cited in the paper). There's no free lunch in GC.
- FooBarWidget 11y agoBut I would argue that most people who use Go, use it to write user-facing server apps, or at least server apps in which response time is an important metric. I don't know anybody who uses Go to primarily write batch jobs where throughput matters more than latency.
- mike_hearn 11y agoYeah, but that's circular - if you did want to write a high performance batch job, maybe you wouldn't use Go because of the GC. And hi by the way ;)
- martijn_himself 11y agoA Golang beginner's question: do these GC improvements make Golang a suitable language/ platform for writing games? EDIT: I realise this is a vague question. I suppose I was wondering if the order of magnitude GC performance in Go is likely to interfere with game loops you might find in reasonably CPU/ GPU intensive Indie games (i.e. NOT Crysis).
- deleted 11y ago[deleted]
- panamafrank 11y agoyes and no, while the previous GC pauses wouldn't have really affected anything the size of a hobby game, the improvements are welcome. The bigger problem with Go regarding game development is operator overloading and interfacing with C, the latter being a pain when it comes to memory management.
- martijn_himself 11y agoWould these GC improvements put Golang in the same league as C# (which is widely used for game development e.g. Unity3D, the .NET runtime has a GC) or can these comparisons not be made?
- pjmlp 11y agoAs heads up when talking about Unity3D, please be aware of the pre-historic .NET runtime they still are shipping versus what Xamarin and Microsoft deliver. So always take the JIT/GC complains in Unity3D context with that caveat in mind.
- martijn_himself 11y agoThanks. Whilst I was aware that Unity3D was shipping with an ancient version of Mono (and more or less consequently with an ancient version of C#), I wasn't aware there were a lot of JIT/GC related complaints against it.
- deskamess 11y agoOn FF 44.0: - The header is cut off - Slide 20 gives an error when running [c: template: redefinition of template "list"] - Stable sort example does not seem to work. Gives same output as regular sort
- armitron 11y agoAm I in the minority to think of Go as a completely unnecessary move-along-now-nothing-to-see-here project? (as if we didn't have enough of that already). The only niche I see for it is for those poor souls who are still wasting their time with Python/Ruby but that by itself surely can't lead to great things for the language, especially since it's riding on air. More dense air than Python but air nonetheless. Also Rob Pike. If there's a guy with the king midas touch of shit, it's Pike.
- aikah 11y ago> Go as a completely unnecessary move-along-now-nothing-to-see-here project I don't like Go type system, but it handles concurrency quite nicely. It's fairly easy to learn and to use so I can see why managers chose it. And it's backed by Google so it can give a sense of safety and it can be used as an argument to sell the language. So it's a bit unfair to say it's unnecessary. It can help when performance is a concern and one doesn't want to go down to C or C++ for some reasons.
- 15155 11y agoDevil's advocate: > but it handles concurrency quite nicely So does Erlang/Elixir, Haskell, Clojure. > And it's backed by Google so it can give a sense of safety How is Dart doing in this department?
- wstrange 11y agoDart is doing fine. It has not replaced Javascript (that was never going to happen) but it has seen a slow but steady growth in adoption. There are some amazing things happening with Dart on mobile (flutter.io), Dart on embedded (fletch), and improved JS interop with things like the Dart Dev Compiler (DDC). Angular 2 is still in Beta, but has first class support for Dart. Perhaps it did not live up to it's initial hype - but Dart is a pretty "safe" bet
- sdegutis 11y agoYeah, you're in the minority. Technology is more or less a popularity contest. I've seen plenty of really good programming languages that simply die out because they don't have high-profile personalities behind them. And there's plenty of "meh" or even terrible languages that make it big because the hype is strong with this one. It's not great but at the end of the day, bits are bits and bytes are bytes, most programming languages are all pretty decent ways to manipulate them. You'd have to do pretty badly to go so terribly wrong that nobody should ever use your language, and I don't think I've ever seen a language that bad.
- ebbv 11y agoTheir solution to the template whitespace thing underlines a fundamental difference between what the Go core developers consider to be good language/library design and what I do. To me adding the - to the template tag {{foo -}} to get rid of whitespace on that side of the tag is totally unintuitive and a really kludgy solution. Sure, it's terse and being terse can be nice, but terseness to me probably doesn't even make it into my top 10 concerns when designing a language or library. In my mind a lot more thought and consideration should be put into solutions for problems that are going into core libraries. Stuffing cute hacks into the core libraries willy nilly leads you to PHP. The consequences of which I deal with daily.
- icholy 11y agoI fail to see what's so "kludgy" about it.
- masklinn 11y agoThis change simply draws from Jinja, which has had this feature for nearly 10 years[0]. It's a simple and efficient solution to the problem of trimming whitespace on either side of a template tag, I fail to see what is kludgy about it (and intuitiveness is in the eye of the beholder). In my experience it's clear, simple and doesn't make the template less readable. > Sure, it's terse and being terse can be nice, but terseness to me probably doesn't even make it into my top 10 concerns when designing a language or library. The whole point of this feature is to be terse, otherwise you could already use template comment to trim formatting whitespace. [0] http://jinja.pocoo.org/docs/dev/templates/#whitespace-control http://jinja.pocoo.org/docs/dev/templates/#whitespace-contro...
- zimpenfish 11y agoPerl's Template Toolkit has had this feature since at least 2001 (and I remember it being available before that but my googlefu is failing me right now.) cf http://www.perl.com/pub/2001/01/tt2.html http://www.perl.com/pub/2001/01/tt2.html > If these tags are replaced with [%- -%] then the preceding or following linefeed is suppressed.
- kasey_junk 11y agoAre there any published benchmarks around allocation times after many garbage collection events with the golang garbage collector? I'm wondering how it holds up without compaction and in the face of fragmented heaps.
- schmichael 11y agoAt work (Lytics) 100% of our backend code has been in Go since the beginning over 3 years ago, so slide #6 highlights one of the most things with nearly every Go release: > Changes to the language: None https://talks.golang.org/2016/state-of-go.slide#6 https://talks.golang.org/2016/state-of-go.slide#6 We generally get our entire stack upgraded to the latest release within 1-3 months with little effort. It wouldn't be much more work to be ready to upgrade on release day, but we haven't found a reason to worry about it. Go is such a breath of fresh air compared to past Java and Python jobs where production was usually at least a major release version behind the latest and there was extra effort spent getting everyone using the same implementation (Oracle Java v OpenJDK or Ubuntu's Python v CentOS's -- there are differences!). Conservative releases aren't a must-have for a language, but I do appreciate having one less operational headache to consider.
- jvehent 11y agoThis is my experience as well. The only thing that somewhat breaks between Go project is vendoring (or lack thereof). But in comparison to the pain of supporting python applications that must run on everything from 2.6.6 to 3.5, Go is a walk in the park.
- Cyph0n 11y agoPython is entirely different; the two languages cannot be compared with regards to backwards compatibility. Python has been around since the early 90s, while Go was conceived very recently. Sooner or later, the quirks that resulted from designing the language so long ago had to be addressed, and that's why there's Python 3. The same can be seen in Java and Ruby. Once Go is used actively for ~9 years (Python 2.0 to 3.0) and suffers no changes that break backwards compatibility, we can compare it with Python.
- kasey_junk 11y agoCan you speak to why you were behind latest on the JVM? I can think of less than a handful of breaking changes over the last 15 years. I'd say it was more stable than Go.
- jibalt 11y agoOh, that Go.
- oliv__ 11y agoI get where we are...but where are we going?
- geostyx 11y agoGo 1.7 Planning: https://groups.google.com/forum/#!topic/golang-dev/TerfinvPffw https://groups.google.com/forum/#!topic/golang-dev/TerfinvPf...
- woofiefa 11y agoI develop a lot of command line tools for Linux using shell scripting. The scripts are getting huge and ugly, so I have been looking at Go and it seems I can do so many things by just using the standard library and in general a big improvement over using scripting. However, everytime Go is discussed at HN I see many posts criticizing the language for various reasons and this has put me off getting started learning Go.
- travjones 11y agoProgramming languages are kind of like religion, or one's favorite beverage/food. Everyone has their own preference/coding style. I wouldn't let negative comments on HN steer you away from learning Go. Of course, I'm biased because I write Go code and enjoy it, but there will always be folks who love something and hate something. You'll never know whether you enjoy coding in Go unless you try it for yourself. Some of the criticisms of Go are valid and some are just haters doing what haters do--hating. Keep in mind Go is very young for a programming language. It's only about 6 years old, but it's use is becoming more and more widespread as it matures. Although you are correct in that the standard library is pretty much all you need to write CLI apps, this library is definitely useful if you're willing to pull in a third-party dependency: https://github.com/codegangsta/cli https://github.com/codegangsta/cli
- tshannon 11y agoI suggest just writing something in it. A lot of the criticisms turned me off as well, but I dove in anyway. I stopped paying attention to the criticisms when I found out how incredibly productive I was able to be in Go. Give it a try and make your own call on it. The cognitive overhead of jumping into Go is so small compared to many other languages.
- BuckRogers 11y ago> The cognitive overhead of jumping into Go is so small compared to many other languages. I'm not using Go now, though I have tried it out years ago. Your point is exactly why it stays on my radar for possible future use. Especially if you consider any sort of business aspect, ramping up the help. I would strongly consider using it for any serious backend project in a business environment due to the performance, ease of learning and compatibility promise.
- ilya1 11y agoI'm wondering who is using Go in production outside US? Noticed couple e-commerce companies and Google itself in Singapore. Few Russian companies are doing small infra project. Anyone else seriously investing in Golang?
- thegeekpirate 11y agoIt's incredibly large in China (Baidu, Qiniu). I apologize since I haven't looked into countries specifically, but to respond to "anyone else seriously investing in Go?", I'll paste it here for you anyways. Walmart, Apple, Facebook, eBay, Intel, Google, Mozilla, IBM, Microsoft, Red Hat, DigitalOcean, Zynga, Yahoo, BBC, VMware, Uber, GitHub, Getty Images, Twitter, Stack Exchange, Docker, SpaceX, Baidu, Qiniu, Imgur, CloudFlare, Bitbucket, Dell, Twitch, Dailymotion, bitly, Cisco, Verizon, Dropbox, Adobe, New York Times, HP, Canonical, Cloud Foundry, 99designs, BuySellAds, CoreOS, MongoDB, Basecamp, Rackspace, Booking, MalwareBytes, Kingsoft, Iron.io, OpenShift, Heroku, Square, Spring, Tumblr, VMWare, Symantec, Comcast, CBS, SendGrid, Digitally Imported, Pivotal, Couchbase, Koding, Shopify, Shutterfly, MaxCDN, Linden Lab, SolarWinds, IMVU, EMC, Teradata, and I'm sure many more which I'm unaware of, are all using Go to some capacity.
- Eric_WVGG 11y agoyes yes, you wrote an AI that beat Fan Hui, we heard, stop bragging
- GreaterFool 11y agoHow about adding a flag to the bloody compiler to allow me to compile my code with unused bits? I refuse to touch Go until that happens. Go is the asshole of programming languages. It forces you to put code in deeply nested annoying directories vim foo.go vim ../../../github.com/blahblah/moreblahblah/blah.go sigh But that I could live with. But constantly commenting the code out (which of course leads to commenting out even more code!) is the real PITA. All said and done it looks like a useful, if uninspired, language. Can avoid it so may as well use it. But this nonsense has to stop!
- nvader 11y agoYou can use the _ signifier to mark imports as optional during development: use import _ "net" Make sure you don't check such lines of code in to your repo, because there is a concrete benefit to having the language enforce this import strictness. But the person who would check in code with unused _ imports, would probably abuse a hypothetical "allow unused imports" flag in production. Go is probably not for that person.
- millstone 11y agoMost Go developers just use goimports. So really this "unused import" warning is a "you forgot to push the magic fix-it button." (Why didn't it push it for me?) Or more to the point, if Go can figure out imports, why require them to be explicit at all?
- BuckRogers 11y ago> Changes to the language: None Best part of Golang, more languages need to borrow this feature. Second best is how relatively easy it is to get going with it.
- trungonnews 11y agoDoes Go have an interactive debugger yet?
- bshanks 11y agoWhat do people think of Go's new(ish) vendoring?