Hacker News new | ask | show | jobs
by AtNightWeCode 1312 days ago
Go compiler is garbage by the design. A 20 year old C compiler does not have this prob. This is also why Go have declined so much during the last couple of years. The benefits of Go have not increased and most of the quirks are still there. Like the error handling, the naive compiler and the syntax sugar that somewhat hides the diff between pointers and direct heap allocs.

-1

3 comments

I work on a code base that is a mixture of Go and C.

It's IO, CPU and Memory hungry, and it's distributed.

C is fast because it's close to how CPU and memory actually work. Go gives you 95+% of that plus easy to learn, easy to use language. A new person could start contributing useful features and bug fixes immediately. A senior person could get C-level performance.

More and more of our code is moved from C to Go, with very little performance penalty, but with a lot more safety and ease of use.

Our customers benefit, and our company makes more money.

In the end, that's what software is about.

> C is fast because it's close to how CPU and memory actually work.

Out-of-order execution, cache hierarchies, branch prediction, virtual memory, pipelining, vector instructions, ILP, NUMA are all pretty transparent to the C spec.

Trying to accommodat hardware quirks with C feels like blackbox engineering. It's certainly better than with managed languages but still....

C is an abstraction, and most (all?) cpu architectures pretends to be c machines.

I don't know of any other way of manipulating the cpu as closely as C and assembly. Do you?

I do prefer Go over C in most cases and it's not like there are no pitfalls in C. It is just disappointing when a lang doesn't improve over time and have the same stupid problems year after year.
Here’s an article that refutes your claims. https://queue.acm.org/detail.cfm?id=3212479
I know about this article. Thank you.

I said C is "close to" how a computer works. C is an abstraction, and most (all?) cpu architectures pretends to be c machines. There was a talk (Kelly?) where even assembly is nowhere close to what a cpu actually does.

I don't know of any other way of manipulating the cpu as closely as C and assembly. Do you?

C is not a good match for modern cpus. https://queue.acm.org/detail.cfm?id=3212479
Can you show any examples of "go compiler being garbage"? In my experience, it often generates much smarter code than C# or Java.