13 ms·
Go runtime: 4 years later
- nhoughto 4y agoI always thought go needed more GC knobs, good that they added this one and the strong reasoning behind it makes sense. Impressive go has got this far with just one knob!
- nwmcsween 4y agoNot trying to be inflammatory but has the pclntab taking ~30% for binary size been fixed yet? IMO it's a pretty severe design choice.
- geodel 4y agowhere is that issue listed?
- Thaxll 4y agoNo one really care about binary size increase , especially because you can run a Go binary in a docker image with 0 dependencies ( scratch image ) which has a very small size.
- nick__m 4y agodo you know how things like tzdata and locale are handled in a single Go executable docker image ?
- twp 4y agotzdata, at least, can be embedded in your binary: https://pkg.go.dev/time/tzdata https://pkg.go.dev/time/tzdata
- intelVISA 4y agoYou can build a much smaller 0 dependency binary in Rust/C so what's the value prop for Go here?
- kungfufrog 4y agoThe value prop is it's not Rust or C?
- intelVISA 4y agoSounds like a sidegrade to be honest, not worth the massive bins
- simiones 4y agoThe single biggest silver bullet for provable bug reduction that has ever been invented: GC. Perhaps the Rust burrow-checker will prove to be the second silver bullet for bug reduction, but for now, the only thing that has ever been invented in programming language design that provably reduces the amount of bugs in an application is having a GC (not types, not getting rid of null values, not monads or other HKTs, not CSP).
- 4y ago
- dewey 4y ago> IMO it's a pretty severe design choice. I don't think that's true, otherwise it would've been fixed already. For the main use case of Go (https://go.dev/blog/survey2022-q2-results https://go.dev/blog/survey2022-q2-results), APIs and web services it just doesn't matter if the binary is 1MB or 30MB. Unless you are working on some embedded systems where space is scarce I don't see it as a big issue.
- morelisp 4y ago1MB vs. 30MB is the difference between: - Pull the prod image to my laptop in ~1 sec vs. pull the image in 10ish seconds - CI build and push the image instantly vs. ~2-3+ seconds - Long-term (1y+) retention of per-pipeline/push artifacts vs. per-branch/tag artifacts. - All images in each node's cache vs. 50% of images in each node's cache. Yeah, I don't really give a shit about the 30MB once it's out there. But there's also all the steps to get it / keep it out there.
- digitaLandscape 4y ago
- philosopher1234 4y agoSome very impressive wins here. Makes one wonder how much better things are going to get in the next few years. All without needing to change my programs!
- throwamon 4y agoStill yearning for an Ocaml-like language that uses the Go runtime.
- pjmlp 4y agoI don't see the point, just use OCaml.
- kevinmgranger 4y agoI don't understand how this is a response to every "I wish I had blank but like ocaml". Threads exist.
- pjmlp 4y agoAs does OCaml since 1996, no need for sugar substitute instead of using the real deal. Compiles to native code, has a repl, version 5 is multicore for those not happy with Lwt or multiprocessing in the UNIX classical style of each tool does one thing, and a GC only second to GHC in handling immutable types.
- kevinmgranger 4y agoI get that everyone has their own favorite tools, but "use a version that isn't out yet, or use separate processes for parallelism" is a non-answer. I'm excited for version 5, but until it's out, it's hard for people to take seriously in conversations about _Go_ of all things.
- wtetzner 4y agoOCaml-on-Go also doesn’t exist…
- pjmlp 4y agoIt is more powerful than Go on every sense, and I really don't get what people think using Go runtime into a completly different language would help. Maybe they should spend more attention in their compiler design classes regarding runtime implementations and language semantics.
- tomalaci 4y agoI have been developing in Go for several years and feel like I have seen most it can offer which is quite a lot for backend/networking systems. Besides its GC implementation that works very well most of the time, it also has simple but strong debugging tools to investigate how well you are handling memory allocation and CPU usage. Enforcing consistent coding style also makes it very easy to read other people's code and quickly contribute. My suggestion to others is to avoid prematurely optimizing memory usage (e.g. trying to do zero-copy implementations) and always investigate performance via these profiling tools Go offers (e.g. pprof). Very often Golang's compiler or runtime will automatically optimize code that may not seem to allocate optimally. There are still downsides but some of them are actively worked on: 1. Generics are still lack-luster (... but good enough to start replacing a lot of boilerplate code and will improve later on) 2. Error handling is still tedious (fortunately it seems to be their next big focus), it should take less code-space and have an option of stack-trace 3. Stdlib logging is too simple, lacks levels and structured-logging-style (currently actively discussed: https://github.com/golang/go/discussions/54763 https://github.com/golang/go/discussions/54763) 4. Low-level UDP networking is weak (soon to be fixed as they accepted this proposal: https://github.com/golang/go/issues/45886 https://github.com/golang/go/issues/45886 ), this will become more important as we transition to QUIC protocol 5. CGo (C interop / C FFI) is pretty bad performance-wise compared to other languages, it's OK if it is an I/O operation but anything C interop that requires low latency won't be running great 6. Similar to other languages, nowadays there are growing external dependency trees (e.g. I always wanted to use testcontainers-go to make integration tests easier but man, have you seen the dependency tree you will pull in with that pacakge?), solution in my eyes is flattening and standardizing most commonly used packages but Go in particular is very opinionated regarding what is included in stdlib The above downsides mostly come from the background of creating distributed data pipelines and certain data collectors/parsers. For building API servers, I keep hearing it is a godsend in its simplicity, so your mileage may vary depending on the business domain you work in. I would be interested to hear other people's experience with Go, however!
- Fire-Dragon-DoL 4y agoAnd don't forget, the plugin API has some super strong limitations. I wish that was fixed, otherwise platforms "similar to wordpress" can never become a thing on Go
- nu11ptr 4y agoI really like the engineering principles in general that the Go team uses, however, I just don't like Go. That isn't meant as a slight or anything other than simply my opinion. That said, I really like the idea of a simple language based on the sort of principles demonstrated here. The runtime seems really nice, I just wish I liked the language better (IMO: not expressive enough, needs better error handling, needs much better enums, needs pattern matching, has error prone C-style 'for', almost everything is statements not expressions, special comments are error prone, has nil pointers, etc.). In the end I think if someone were to write a slightly simpler version of Rust with the Go runtime it might be pretty neat. That said, I don't know what I'd want to drop from Rust so maybe I'm just fantasizing.
- Thaxll 4y agoRust is adding new features at the speed of C++/C# which is quite bad imo, it's good a recipe to have different code base / way of doing things in just couple of years apart. Now for Rust there are many things that could be changed, async etc ...
- drogus 4y agoWhat exactly has Rust added in recent months or even years? The way I see it most changes in the language are making existing features work more consistently.
- nu11ptr 4y agoAt first I thought this too, but if you look at the actual "features" they are adding they are all more less just smoothing out existing features. There aren't really any major new ones I can't think of that expand the "surface area" of the language. There is just a lot of polish still needed, esp. to things like async, const, etc. and most of the features appearing are about reducing the burden to use existing features.
- pitaj 4y agoExactly. All of the recent big features were added a few years ago, and now they're really just filling in the gaps.
- tbrock 4y agoI am not a fan of new knobs like this. It reminds me of Java where you actually have to think about -xMx blah blah and setting it is a dark art. I would really prefer if we could somehow confer the memory limit from the container environment to go so this could be set intuitively at the container level without mucking about in the go GC internals.
- mort96 4y agoI'm sure the goal will always be to be as good as humanly possible out of the box. 99.999% of users will probably never have to think about it. But if your mission-critical application just happens to hit a case which the default behavior handles poorly, would you rather: 1) redesign your system and hope that a different design just happens to not hit the same bad case, or 2) tweak a knob until the GC fits your use case? I think I'd prefer 2. But 1 will always remain an option I suppose.
- spullara 4y agoYou are actually suggesting what Java does in a container environment lol. https://developers.redhat.com/articles/2022/04/19/java-17-whats-new-openjdks-container-awareness https://developers.redhat.com/articles/2022/04/19/java-17-wh...
- uup 4y agoMaybe now, but in the past you'd have to worry about things like running out of PermGen space. There were definitely more knobs than a typical container environment.
- synergy20 4y agoIt is probably a bit misleading when so many say: 'golang is easy', it is not, it is as difficult as Java or other language, probably easier than c++ and rust, but definitely not an easy language. it makes great sense for network with concurrency, not so with real time or low resource devices to me.
- mort96 4y agoI always found languages which require you to always remember to manually call destructors to be quite hard, be they C or Go or JavaScript, when the system has lots of moving parts and performance is a concern. A single mistake and you're leaking.
- asp_hornet 4y agoGo doesn’t require you to call a destructor
- morelisp 4y agoClose, e.g., is a destructor in this context. Defer helps but some true lexical scoping might be nicer.
- andsoitis 4y ago> remember to manually call destructors to be quite hard, be they C or Go or JavaScript I thought JacaScript doesn’t have destructors (in the memory/resource management sense) or finalizers…
- mort96 4y agoFile handle destructor: https://nodejs.org/api/fs.html#filehandleclose https://nodejs.org/api/fs.html#filehandleclose WebSocket's destructor: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/c... HTTP server's destructor: https://nodejs.org/api/http.html#serverclosecallback https://nodejs.org/api/http.html#serverclosecallback Etc etc etc. You're right that JS/C/Go don't have language features called destructors, but they have a whole bunch of types with ad-hoc destructor functions which you have to remember to call if you want to avoid leaking resources.
- BenFrantzDale 4y agoAfter being bitten by the overhead of Go’s GC, we stopped using it and went back to time-tested C++.
- pbohun 4y agoI'm really grateful for everyone who has made Go possible and continues to make it better. Well done language design, extensive standard library, good tooling, and great documentation is something that's almost impossible to find despite there being a multitude of languages.
- geenat 4y agoLove go as a platform.. self contained binaries have been a miracle for ops..but have a few big hangups about using the language full time because of the sucky ergonomics. * No optional/named parameters. Writing a whole function per parameter for function chaining is excessive. This would not be difficult to add to the compiler (i've done it and have seriously considered using the fork) but it seems like the team is just stubborn about adding stuff like this. * No default struct values. 0 isn't good enough in real world scenarios.. have fun writing BlahInit(...) for everything. * Would be nice to get the question mark syntax for error handling. Error handling shorthand for if err != nil would also be very welcome.
- doctor_eval 4y ago> No default struct values I love Go too but this does drive me nuts, especially when parsing JSON and wanting to set sane defaults for missing values. Like, for example, booleans that should default to "true".
- xvello 4y agoFor that use case, I think that you can assign your defaults before passing your target struct to the unmarshaller. The unmarshaller will iterate on the json input and set struct fields when json fields are found. This means that struct fields that don't match the json are ignored, and values you have set before will be left as is.
- doctor_eval 4y agoWhile true, this approach doesn’t work for nested structs, which are instantiated by the parser.
- icholy 4y agoWrite a DefaultFoo function which returns a Foo with default values set. Then unmarshal into that.
- baby 4y agoI think if Golang would have been invented a couple of years later it def would have had sum types. But then, Rust probably wouldn’t have had its insane tooling that is most likely inspired by golang
- deleted 4y ago[deleted]
- hknmtt 4y ago
- baby 4y agoWhat do you have against BLM?
- wooque 4y agoNot him, but people outside of US don't care about US social and political issues. Even if Go is used 90% by Americans, website for programming language is still not a place to push politics.
- rob74 4y agoI'm not from the US either, but I don't think that asserting that all people should be treated equally is "politics". Actually it's a basic human right that I think most of us agree with - at least in theory, the problems only come when applying it in practice...
- Tozen 4y agoSo, if people inside the US said that about the plight of people in Europe and various particular countries, would you agree? Somehow I don't think so. Let's not let bias, blind us to important socio-economic or human rights issues.
- baby 4y agoIt sounds like it's more than "don't care", it's a "I'm appalled enough to make a comment"
- peterashford 4y agoI'm from New Zealand. There's support for BLM here. It's not like being non-white is a US only issue
- tomohawk 4y agoNothing against the statement, but the related politics led to this outcome: https://www.cnn.com/2022/09/25/us/minneapolis-crime-defund-invs/index.html https://www.cnn.com/2022/09/25/us/minneapolis-crime-defund-i... And the organization named BLM didn't live up to its name: https://www.washingtonexaminer.com/news/blms-millions-go-unaccounted-for-after-leaders-quietly-jump-ship https://www.washingtonexaminer.com/news/blms-millions-go-una...