3 ms·
This is fairly damning and another data point that indicates that go (and garbage-collected languages/runtimes in general) may be poor successors to C and C++ f
by musicale 6y ago
This is fairly damning and another data point that indicates that go (and garbage-collected languages/runtimes in general) may be poor successors to C and C++ for applications where consistent performance and memory efficiency are important.
I'm sure there are tricks you can do in go (as in java) to subvert the garbage collector, but I'm not sure I'd want to build a kernel based on them when I could just use another language.
Another data point is Apple adopting automatic reference counting for objC and Swift. Another is Discord switching from go to Rust ("go did not meet our performance targets.")
Potentially an OS kernel written (for example) in a language like Rust (though not without its own challenges) could have more consistent performance and lower memory overhead.
disclaimer: I am aware of OS kernels written in Rust but have no experience developing or using one
- pjmlp 6y agoDon't mistake lack of effort in improving performace, with what could be achieved. Were we having this discussion during the 80's, no one would think C was usable for anything serious, when its compilers couldn't produce better code than junior Assembly developers and all AAA games of the time were 100% Assembly.
- higerordermap 6y ago> Potentially an OS kernel written (for example) in a language like Rust (though not without its own challenges) could have more consistent performance and lower memory overhead. Yeah potentially, but implementing in easier language in less time may be acceptable trade-off. Because Go is not poster child of fast GC'd languages either (conscious choice of a simpler optimzer for fast builds), and the implementation only showed 10%-15% difference with linux, the situation is optimistic. With better escape analysis in GC languages and better compilers, the gap can be reduced further. > Apple adopting ARC That's because of legacy interop concerns mainly. Swift's ARC implementation was once horrible, and ARC still seems to be a significant bottleneck in SwiftUI. The ARC more efficient blanket statement myth is mainly spread by apple fanboys, who might not even have heard the words 'cache' and 'contention'. The efficient ARC methods like deferred RC approach a tracing GC. The benefit of RC is predictability (though not always) & RAII. That's why Rust and many C codebases use explicit refcounting when lifetimes are unknown.
- heavenlyblue 6y ago> With better escape analysis in GC languages and better compilers, the gap can be reduced further. While making the compiler slower, contradicting the upside you mention earlier.
- higerordermap 6y agoBetter escape analysis doesn't take much time. Not to mention 70% of optimization can be done in 10% of code and much faster. It is the more exotic optimizations that have diminishing returns for slow compile times.
- koffiezet 6y agoNow I would probably also pick rust over go for something like an operating system, but this here was written explicitly to research the performance trade-offs of writing it in a high-level gc'd language. > go (and garbage-collected languages/runtimes in general) may be poor successors to C and C++ for applications where consistent performance and memory efficiency are important. I think the latter part here is indeed important. From my pov, Go is a lot better suited for a lot of the stuff I previously used C/C++ for, where a scripting language like Python was sometimes an alternative. I rarely touch C/C++ anymore these days (except for arduino stuff), and python, which I used a lot before, has become something I only use when I really need a dynamic language for some hacky stuff. But languages are just tools, pick the best-one for your problem. Go certainly carved out it's niche, and Rust is also going pretty strong, and although maybe not as accepted, is also very interesting and promising.