5 ms·
We'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
by pimeys 10y ago
We'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.