6 ms·
> Go I just don't like as a language (personal taste) and I think the GC adds a bit too much of pausing for this app Not saying you have to like Go, we all hav
by gizzlon 10y ago
> Go I just don't like as a language (personal taste) and I think the GC adds a bit too much of pausing for this app
Not saying you have to like Go, we all have different preferences. But FYI, the gc has gotten much better in the latest releases. I don't think you would be bothered by gc pauses. (my understanding is that it' both faster and more "spread out")
- pimeys 10y agoWe're doing real time stuff where these pauses matter. Just that we don't really need GC for anything and adding it to certain services cause more harm than it causes good.
- gizzlon 10y agoCurious, how long can a pause be before it's a problem? (I do not write these kind of services)
- jerf 10y ago"It depends". Some services are insensitive to pauses of several minutes (email processing; you may not want it there all the time but spikes to that level are often acceptable). Some services are sensitive to pauses in the single-digit milliseconds (for instance trying to maintain a high frame rate).
- pimeys 10y agoIf the execution is measured in nanoseconds, the GC pauses are measured in millisecond, sometimes tens or hundreds... Also RAM has a cost, for garbage collected service you need to reserve some extra RAM. Scaling these processes add an extra memory overhead we're not so eager to take.
- gizzlon 10y agoOki, got it. Can't decide if that sounds like horrible conditions or a fun challenge =) For reference, the Go 1.5 GC propaganda: > Go 1.5, the first glimpse of this future, achieves GC latencies well below the 10 millisecond goal we set a year ago. Blog post: https://blog.golang.org/go15gc https://blog.golang.org/go15gc Slide: https://talks.golang.org/2015/go-gc.pdf https://talks.golang.org/2015/go-gc.pdf Talk: https://www.youtube.com/watch?v=aiv1JOfMjm0 https://www.youtube.com/watch?v=aiv1JOfMjm0 Edit: Meanwhile, over in Java land they measure stop the world pauses in seconds, not milliseconds: http://stackoverflow.com/questions/15696585/long-gc-pauses-in-application http://stackoverflow.com/questions/15696585/long-gc-pauses-i... https://blogs.oracle.com/poonam/entry/troubleshooting_long_gc_pauses https://blogs.oracle.com/poonam/entry/troubleshooting_long_g...
- vvanders 10y ago10ms is also 2/3rds of a frame @ 60FPS which is going to guarantee dropped frames if you're doing anything soft real-time. Also most GC'd languages don't give you strong control over data locality(by nature of everything being a reference) so you pay in cache misses which are not cheap.
- shinymark 10y agoFor another comparison 10 ms is nearly your entire frame at 90hz for current VR headsets.
- jerf 10y agoGo gives you decent control over layout, much better than most scripting languages. It's not quite as good as C, mostly due to not having a wide variety of very complicated data structures to choose from; you've got structs, arrays, and maps. But the first two in particular let you do many things to control locality. It's also worth pointing out 10ms is the maximum, not the minimum. There's plenty of workloads where you're not going to see pauses anywhere near that long. It's certainly not impossible to write a 3D game in Go and get 60 fps with high reliability, especially with the amount of stuff nowadays that actually runs on the GPU. You're not going to be able to do this for your next AAA game, but I wouldn't see a huge reason that an "indie" game couldn't use Go for that. (Probably not my first choice, all else being equal with library support personally I'd suggest Rust for this for a lot of other reasons (the type of concurrency you often get in games is going to be well supported with Rust's borrow checker architecture), but contrary to some discussion I would say it is still on the table.)
- falcolas 10y agoHow do you handle the reference counting pauses in Rust then; rely on them being deterministic? Or do you completely avoid the reference counting boxes?
- kibwen 10y agoNot the OP, but in my experience it's fairly rare to encounter someone using the `Rc` type in Rust. It's nowhere near as prevalent as `shared_ptr` seems to be in C++, for example.
- pimeys 10y agoThere is also the `Arc` type, which is an atomic reference counter. You still need those, especially if you need to share stuff between multiple threads.
- Jweb_Guru 10y agoYou can often get away with using scoped threads.
- vvanders 10y agoYeah, a lot of that has to do with the borrow checker guiding you towards single-ownership designs with is a good thing(tm).
- pimeys 10y agoThis is a good article about different wrapper types in Rust http://manishearth.github.io/blog/2015/05/27/wrapper-types-in-rust-choosing-your-guarantees/ http://manishearth.github.io/blog/2015/05/27/wrapper-types-i...
- dikaiosune 10y agoHow does reference counting pause? There's no stop-the-world GC action, as the garbage collection is amortized over every object deallocating itself.
- jeffdavis 10y agoPersonally, I don't care about the pauses, I care about having a complex runtime. Consider a widely deployed library written in C -- say, zlib or libjpeg or SQLite or openssl. Could you rewrite those in Go or Haskell or Scala? No. Because nobody wants a big surprise when linking a harmless C library all of a sudden brings in an entire GC that's starting extra threads, etc. In other words, Rust is the first practical language in a long time that could be used for a new library that might be used in millions of different applications written in dozens of languages.
- Matthias247 10y agoI played a little bit around with Go currently, and thereby ported a part of an older application for which I already have C++, C#, Java and other implementations and benchmarks to compare them. My current results is that Go performance can be really good (C++ level) if I try to avoid allocations as much as possible. With a more sloppy implementation that e.g. did not reuse buffer objects ([]byte) between multiple network packets the performance dropped significantly to about 1/3 of the C++ implementation, and the GC time dominated. Fortunatly it's quite easy to avoid garbage in Go, as we have value types there and the synchronous programming style means lots of stuff can be put on the stack and there's not so much gargabe due to captured objects in closures and similar stuff. All in all I'm quite confident that with a mediocre amount of optimization Go can be suitable for lots of application types. Although I would not necessarily try to use it for low-latency audio processing if something else (that produces garbage) is running in the same process.
- dorfsmay 10y agoIf you're going to work at that low a level, what are the advantages of golang over rust?