5 ms·
Drivers, operating systems, databases, browsers and games written in garbage collected languages? How will they manage to be competitive? C is currently one of
by orangetuba 4y ago
Drivers, operating systems, databases, browsers and games written in garbage collected languages? How will they manage to be competitive? C is currently one of the most used languages in the world.
I don't think that they are trying to replace Java or Python, but C, for the areas where C is used today.
- duped 4y agoI see a lot of misplaced hate thrown at garbage collection without warrant. Some things don't make sense to use GC for (for example, allocators or garbage collectors themselves), but modern GC is as fast if not faster than manual memory management at scale. The performance issues often attributed to GC often come from more obvious issues, like dynamic dispatch, boxing/unboxing of values, and dynamic typing. It's just somewhat rare to see statically typed languages with modern concurrent GC. Go is one example, and Go is remarkably fast. Meanwhile Java has been running on more resource constrained systems for 30 years than Rust can target today, for example.
- orangetuba 4y agoDo you predict a future where drivers, operating systems, databases, browsers and games etc. will be written in a language such as Go?
- duped 4y agoThere are already drivers, databases, and games written in GC'd environments. Operating systems are not monolithic enough to say anything, some portions can and probably should be gc'd and others require explicit control over memory operations that don't make sense to a GC. Browsers already have a significant amount of work that they do using garbage collection. So not so much future as present.
- orangetuba 4y agoI have looked at some benchmarks, and in nearly every benchmark I can find, Go takes 2-4 times as long as C to perform the majority of tasks (except when it is much, much slower). I believe the original Minecraft is written in Java(?), but it's not really competitive with something like Unreal Engine. Out of curiosity, which databases are written in GCed environments?
- duped 4y agoC is significantly slower at concurrency when implemented naively. It's as fast as languages like Go when implemented using the same techniques, which is not obvious and trivial to use like in a higher level GC'd language. GC actually helps out a ton there, for example look at the complexity of async/await in Rust which requires the notion of pinning. Unreal packs its own garbage collection. This is a pattern you see quite often, GC is discarded because it's slow/the specific implementations don't fit the task, so an alternative GC is written to be used in a lower level language that doesn't require it natively. Contrast to Unity which uses C#. As for Minecraft, like I said originally you don't want to look at just GC for performance problems - that's a naive understanding of why languages perform poorly. Java is actually extremely fast and used in environments with tighter constraints than a game like MC. https://github.com/gostor/awesome-go-storage#database https://github.com/gostor/awesome-go-storage#database https://java-source.net/open-source/database-engines https://java-source.net/open-source/database-engines Not a database but honorable mention, LMAX disrupter: https://lmax-exchange.github.io/disruptor/ https://lmax-exchange.github.io/disruptor/
- orangetuba 4y ago"C is slower at concurrency when implemented naively" That's a bit like saying that a Formula 1 car is slower than a Toyota Yaris when operated by a poor driver? What are you implying here? So you're saying that with languages without GC, you can tailor your own GC that is a good fit to the problem you're trying to solve? Or that when the problem you are trying to solve is a good fit for the GC in your language of choice, you get good performance with less effort? That's a huge list of databases that I've never heard of. In a sample of the categories, I looked for the most performant one, such as "NoSQL" where the one that comes out as best on benchmarks was Mongo DB which is written in C++. Why are all the number on spots on benchmarks written in C or C++ when the potential of GC languages is higher? Or maybe I'm misunderstanding.
- kjs3 4y agoWhy try to predict the future and forget the past? John McCarthy proposed GC in the 60s, and we had operating systems in the early 80s implemented in GCed languages. See, for example, Symbolics Genera (lisp) or Smalltalk-80. Xerox Cedar/Mesa based OSes too. Pretty sure Perq POS was GCed (heavily enhanced Pascal) but don't remember for sure. So, yes, if it makes sense, you can write drivers, operating systems, databases, browsers and games etc.
- orangetuba 4y agoWhy have all modern operating systems (that have more than 100 users) moved away from GCed languages?
- kjs3 4y agoI won't speak to 'all modern operating systems', nor 'more than 100 users', because who really knows how to enumerate either of those. But given the OSes that the vast if not overwhelming majority of people use, 'because C' seems like the easy answer.