3 ms·
I see why go is clearly superior to C++. I see why it's simplicity is great for bringing new people up to speed. I see why it's concurrency model is better than
by JamesBarney 6y ago
I see why go is clearly superior to C++. I see why it's simplicity is great for bringing new people up to speed. I see why it's concurrency model is better than many other languages. And I really like their software engineering philosophy.
Go seems clearly one of the if not the best systems language around.
But how is Go in the line of business web application space? The space that's historically been dominated by your Python, Ruby, Go , node.js, C#, Java applications?
I get it's probably more performant, but honestly in C# my primary language I spend almost all my time optimizing DB queries and almost none optimizing C# code. I get it's concurrency model is better, but with web apps that usually isn't much of a problem.
Is Go as better in this space as it clearly is in the systems programming space?
I get it could be used for the LoB use case but is it better, and if so is it significantly or marginally better?
- saagarjha 6y ago> I see why go is clearly superior to C++. You shouldn't. If anything you should be looking into where C++ does better than Go and see if Go is improving there–and understanding that there will always be places where Go is not the best choice or even appropriate.
- JamesBarney 6y agoI'm sure Go is not better for every single use case. But it seems to be there were a lot of high performance systems that would have been written in C++, like InfluxDb for example that are clearly more reliable and easier to develop because it was written in Go. Where do you think C++ outshines Go?
- jeffbee 6y agoI think that's an example of a system where the performance demands weren't high enough to justify using C++. There are lots and lots of applications where the overall architecture can't take advantage of the speed of C++, but I think there's no question that the peak performance of C++ far outshines the abilities of Go. Taking an example from the article, parts of Google's indexing pipeline are now in Go, but nobody is suggesting that the search engine would be.
- cdelsolar 6y agoGo is basically almost as fast as C++.
- jeffbee 6y agoAnd cat food is "basically" pâté. The Go toolchain lacks virtually all of the optimizations that a C++ compiler would employ in an optimized build and the Go toolchain also lacks all of the ways you'd achieve peak optimization for C++, such as profile-guided optimization and link-time interprocedural optimization. These programs are are not even peak optimized but the C++ version still wins every case by between 10% and 1000%. https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/go-gpp.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- saagarjha 6y agoPerformance, as 'jeffbee mentioned, but it's also great for low-level systems programming, has multiple high-quality implementations, powerful compile-time features, and can interact particularly easily with mountains of already existing C and C++ code.
- blaisio 6y agoI think you might have bad information. Go is not a systems programming language. You may be thinking of Rust? Go and C++ serve very different needs.
- eloff 6y agoYou're being downvoted, but you're correct. Go and C++ have largely different non-overlapping use cases. Go is not a systems language. It's mostly a networked server language with a garbage collector. It's great for writing a wide variety of networked services like HTTP app servers. C++ is great for when you need full control and best possible performance and are willing to pay the hits in complexity, compile time, and other development expenses to achieve that. Drivers, games, trading software, database engines, etc.
- jrockway 6y agoI think I only agree with you on games and trading software. In games, you have 4ms (assuming an esports game at 240Hz) to read input, read game state from the network, do all your simulation, draw a frame to the screen, and write the results back to the network. There is absolutely no time budget for anything else; in fact, C++ games don't even manage to run at a 240Hz tickrate and just hack around the input / display handling while they wait for 60Hz networking and simulation run in another thread. (Going off topic, the end result of all of this is an incredible example of what "eventual consistency" means in the real world. Play a multiplayer FPS and you'll never use a database in any mode other than strict serializable again.) For drivers and database implementations, there is more time to do stuff. For example, I wrote a keyboard controller with Tinygo, and it mostly sits around waiting for the USB host's C++ driver to ask it for data. Go isn't adding any latency (and it's not really C++'s fault either; the standard sets a time interval to poll at). And if you wonder what an OS written in Go would look like, look at gVisor. It's not technically an OS, but it does a large number of OS-like things. Database engines that are focused on throughput rather than latency will also do fine with an occasional GC delay. CockroachDB and InfluxDB have plenty of users.
- 6y ago