The Go compiler has a good balance between compilation speed and optimization. Answer from Thaxll on reddit.com
🌐
Quora
quora.com › How-does-the-speed-of-Golang-compare-to-that-of-C-C-Python-and-Rust
How does the speed of Golang compare to that of C, C++, Python, and Rust? - Quora
Answer: In general, you will find Golang is roughly the same as C, C++ or Rust, slower than well written and optimised C, C++ or Rust, and much faster than Python. But that is a generalisation.
🌐
Google Groups
groups.google.com › g › golang-nuts › c › n12khle-mlY
Go vs C speed - What am I doing wrong?
Back then people used to think that C was slow compared to ASM. In fact, C is still slow compared to well-written ASM code. Often, C++ compilers are able to produce much more efficient code compared to C, thanks to some C++ constructs that allow the compilers to make better optimization decision.
Discussions

Is Golang really a competitor to C++ ?
It was meant to displace C++ for server code at Google. Not for all the other stuff C++ does. And Pike said later they were somewhat successful at that but not as much as they wanted. More on reddit.com
🌐 r/golang
187
133
March 21, 2024
How similar is GO to C?
They are particularly similar in style. Ken Thompson and Rob Pike worked at Bell Labs after all, with Ken having been one of the first users of C in general. Rob wrote his notes on programming in C in the late 80s, which IMHO is still great advice for writing good C code. Much of the most beautiful C I've seen is from the source code of Plan 9, an operating system they developed at Bell Labs. So when they created Go, they came from a C background, in the sense that they hadn't only used C for decades, but also helped shape it from the very beginning. One of the best aspects of C is how orthogonal it feels. You write your structs that are plain data. You write your functions that are plain code. Your functions do what you see written. No more, no less. Go feels very similar to that. It doesn't try to retain any kind of compatibility with C, but rather tries to distill its spirit even further, with even fewer keywords (none of which are adjectives, which means you don't get tons of weird interactions of modifiers like e.g. in Java). It's definitely higher level than C. Your indices are bounds checked, memory is automatically allocated and freed as you use it, etc. So no dangling pointers and segfaults to worry about, but it still gives you the ability to have a pointer point at some value inside another data structure. There's no pointer arithmetic but there are slices which can often be used in similar ways. More on reddit.com
🌐 r/golang
18
36
April 13, 2023
Why is Golang not as performant as C or C++?

Some people like to blame all of the slowness of languages like Go, C#, and Java on garbage collection, but that isn't a very complete story. People will correctly tell you that normally garbage collection takes up a very very small % of total runtime, and that is true, so what else is going on? There are some indirect and related things as well.

  • Languages that have garbage collection are attempting to be memory safe languages, so:

    • They will also tend to have array bounds checks when the compiler can't prove they can be elided

    • They will tend not to allow as many clever casts

    • They will tend not to allow pointer arithmetic

    • Providing ways to leverage SIMD instructions by hand is hard (Go gives access only through Go assembler at the moment)

    • They will tend not to have a way for the compiler to do floating point optimizations that can change results like --ffast-math in C compilers

  • Garbage Collection has some indirect effects aside from how much time is spent doing GC

    • Every time the GC runs it pollutes the CPU caches, slowing down code that runs later

    • GC will normally imply a degree of overhead when doing FFI (interop with other languages). Go has even more overhead due to how it manages it's stack, which facilitates goroutine features. Lots of things require FFI still (3d rendering, for example) so those things will always be slower.

    • The control you get over memory layout of your data is usually limited to some degree. For instance in Go you can't explicitly control whether data goes on the stack, or heap, or *where* to goes on the heap. On the bright side in Go you can at least work with any type you create as a value or a reference, so you can at least control things like making sure your array is an array of values in contiguous memory vs an array of references, which you can't in Java. Accessing RAM is very slow, controlling memory layout on modern computers can be a big deal, assuring that you hit the L1 and L2 cache as much as possible.

There are also just some cultural things, people working on the C and C++ ecosystems are doing so because performance is priority one. People working on ecosystems of memory safe languages obviously have a bit of priority for safety, correctness, or productivity or they wouldn't want the GC!

None of these things in isolation is normally a very big deal but they can add up.

More on reddit.com
🌐 r/golang
131
92
January 12, 2019
Why is golang's performance worse than Java's in this benchmark game?

Yes, it is memory allocator and probably the fact that bottomUpTree() is called a lot, recursively.

That being said, making sweeping statements (like "Go's GC is immature") based on a single benchmark is not exactly right. Both Go and Java have state-of-the art garbage collectors but they are tuned for different scenarios and this benchmark has a workload that heavily favors Java's GC.

Why? Because Java's collector is generational. That means that allocation is extremely cheap (bump of the pointer). The downside is that generational GCs use more memory and when objects are moved from nursery to tenured heap, there's additional work of copying the memory.

Go's GC is not generational, so allocation requires (comparatively speaking) much more work. It's also tuned for low latency (smallest pause when GC has to stop the program) at the expense of throughput (i.e. total speed). This is the right trade-off for most programs but doesn't perform optimally on micro-benchmarks that measure throughtput.

I've made a Go version that allocates nodes in bulk https://gist.github.com/kjk/4620bf60315d3fdd3f210e4590bdf1cb using a pool allocator of nodes.

On my machine it goes from 17s to 9s (if I allocate 1024 nodes at a time) or 7s (if I allocate 32*1024 nodes at a time).

In this particular program the number of nodes could be calculated up-front so it could be sped up even more.

Another thing where Java probably has an advantage is the fact that almost all the time is spent calling bottomUpTree() a lot, recursively.

Why is it worse than in Java?

To make goroutines cheap, Go starts each goroutine with very small stack (~4kb). As a result, Go has to expand the stack when needed. Go does that by checking stack size at the beginning of every function call. When it detects it needs more stack, it creates a new, bigger stack and copies the old stack to new one.

The cost is usually very small (few instructions for each function call) but if there is a function like bottomUpTree() that does little work and is called very often, even small cost adds up.

Additionally, this is deeply recursive call, so stack is being copied several times when it needs to be expanded.

I'm pretty sure that if you rewrote bottomUpTree() to be non-recursive (non-trivial but possible) and used pool allocator for nodes, Go version would be as good (if not better) than Java.

More on reddit.com
🌐 r/golang
16
5
December 29, 2016
🌐
Reddit
reddit.com › r/golang › why is golang not as performant as c or c++?
r/golang on Reddit: Why is Golang not as performant as C or C++?
January 12, 2019 -

Hi all,

First of all, forgive me to ask this. I am a noob to Golang and find it very promising to learn. I read that Golang is not as performant as C or C++ code. What's the reason behind this? AFAIK Golang is very close to C or inherits many features. If this is the case, why is Golang gaining popularity? How about the future of Golang developers? What's the primary domain of use - cloud?

Top answer
1 of 14
248

Some people like to blame all of the slowness of languages like Go, C#, and Java on garbage collection, but that isn't a very complete story. People will correctly tell you that normally garbage collection takes up a very very small % of total runtime, and that is true, so what else is going on? There are some indirect and related things as well.

  • Languages that have garbage collection are attempting to be memory safe languages, so:

    • They will also tend to have array bounds checks when the compiler can't prove they can be elided

    • They will tend not to allow as many clever casts

    • They will tend not to allow pointer arithmetic

    • Providing ways to leverage SIMD instructions by hand is hard (Go gives access only through Go assembler at the moment)

    • They will tend not to have a way for the compiler to do floating point optimizations that can change results like --ffast-math in C compilers

  • Garbage Collection has some indirect effects aside from how much time is spent doing GC

    • Every time the GC runs it pollutes the CPU caches, slowing down code that runs later

    • GC will normally imply a degree of overhead when doing FFI (interop with other languages). Go has even more overhead due to how it manages it's stack, which facilitates goroutine features. Lots of things require FFI still (3d rendering, for example) so those things will always be slower.

    • The control you get over memory layout of your data is usually limited to some degree. For instance in Go you can't explicitly control whether data goes on the stack, or heap, or *where* to goes on the heap. On the bright side in Go you can at least work with any type you create as a value or a reference, so you can at least control things like making sure your array is an array of values in contiguous memory vs an array of references, which you can't in Java. Accessing RAM is very slow, controlling memory layout on modern computers can be a big deal, assuring that you hit the L1 and L2 cache as much as possible.

There are also just some cultural things, people working on the C and C++ ecosystems are doing so because performance is priority one. People working on ecosystems of memory safe languages obviously have a bit of priority for safety, correctness, or productivity or they wouldn't want the GC!

None of these things in isolation is normally a very big deal but they can add up.

2 of 14
44

There are tons of differences in the implementations of C and Go that slightly slow down Go in favour of safety. A few things:

  • goroutine scheduling

  • growing stacks

  • Runtime checks for memory access (you panic on nil not segfault)

  • runtime reflection

  • Bounds checking on arrays/slices

  • No naive casting (safe type assertion)

  • Different calling conventions

    • this allows panics at any pint

    • Go relies more on the stack (no fastcall)

  • Defer

  • Much fewer optimizations in favour of fast compile times

  • latency optimized GC, this limits throughput

All of this and much more lead to the fact that cgo has quite some overhead.

C is still the most dominant language and this will be remain true longer than we all live. Go improves C in lots of aspects that address issues faced today.

  1. Go is memory safe making it way less dangerous to program critical systems

  2. Great multicore capabilities in times after Moore's law

  3. Go scales great

🌐
Orient Software
orientsoftware.com › blog › golang-performance
Golang Performance: Go Programming Language vs. Other Languages
July 4, 2023 - The biggest advantage of Go when compared to other languages is its built-in support for concurrency through channels and goroutines. Golang is considered an optimal choice for building cloud-native applications and high-performance microservices.
🌐
Programming Language Benchmarks
programming-language-benchmarks.vercel.app › go-vs-c
Go VS C benchmarks, Which programming language or compiler is faster
* (You may find time < time(user) + time(sys) for some non-parallelized programs, the overhead is from GC or JIT compiler, which are allowed to take advantage of multi-cores as that's more close to real-world scenarios.)
🌐
Career Karma
careerkarma.com › blog › tech guides › go vs c++ compared and contrasted
Go vs C++: A Complete Comparison | Career Karma
July 20, 2022 - Go is very fast compared to other high-level programming languages. It’s compilation, static types, and efficient garbage collector make it extremely quick. Go is also good at memory management; it has pointers instead of references.
🌐
DEV Community
dev.to › ayushpattnaik › how-fast-is-golang-385
How fast is Golang? - DEV Community
September 25, 2024 - Golang is fast but not as fast as C++. C++ is the fastest compiled language, which means it comes out ahead of Go in terms of performance. That said, Go does have some advantages over other languages like Java and C#: for example, it’s easier ...
Find elsewhere
🌐
Avatao
avatao.com › home › go vs c: why consider go instead of c?
Go vs C: Why Consider Go Instead of C? -
July 2, 2025 - Looking at who triumphs from Golang ... simplicity, and cross-compilation make it a great choice for developers. Golang performance is comparable to C and it can be a great choice for many types of projects....
🌐
Blackdown
blackdown.org › home › golang vs. c++ – a complete comparison
Golang vs. C++ - A Complete Comparison - Blackdown
October 2, 2025 - If we compare C++ vs Golang performance, Go is not slower than C++. Programming languages are either designed to be powerful or safe; if C++ is more performant, you can generally infer that it is more secure.
🌐
GoLinuxCloud
golinuxcloud.com › home › golang performance comparison | why is go fast?
Golang Performance Comparison | Why is GO Fast? | GoLinuxCloud
January 3, 2024 - Examples of other popular compiled languages include C, C++, and Swift. Programs written in these languages are transformed into machine code and can perform extremely fast. Programmers coming from single-threaded scripting languages like Node.js, ...
🌐
Boot.dev
blog.boot.dev › golang › go-vs-c-plus-plus-golang
Golang vs C++: Which Is Best for Your Next Project | Boot.dev
October 1, 2022 - Overall, Golang beats C++ hands down when it comes to coding speed. Both languages boast fantastic performance metrics. Go’s efficient garbage collector, static types, and compilation make it incredibly fast, as well as its memory management ...
🌐
Slant
slant.co › versus › 113 › 126 › ~c_vs_go
Slant - C vs Go detailed comparison as of 2026
There are languages like Rust, Object Pascal, D, Golang, Vlang, Odin, Zig, Jai, etc... that can be used instead. The other languages are easier to understand, use, and/or about as fast.
🌐
Hacker News
news.ycombinator.com › item
Is Golang significantly slower than c++ ? I thought Google had invented Golang t... | Hacker News
July 2, 2019 - I had thought most of the systems code inside Google would be golang by now. is that not the case ? the code doesnt look too big - I dont think porting is the big issue · Rewriting decades of core business logic would be a tremendous effort and amount of risk
🌐
Stack Overflow
stackoverflow.blog › 2022 › 04 › 04 › comparing-go-vs-c-in-embedded-applications
Comparing Go vs. C in embedded applications - Stack Overflow
April 4, 2022 - CC++C++/QtGoSize overhead of the test component, and all the new libraries pulled in, when using the smallest available Yocto image as a basis8.4MB10.2MB20.8MB14.6MBSize with network stack13.4MB (curl)15.2MB (curl)20.8MB*14.6MBShared dependenciesYesYesYesNoExtra Yocto layer neededNoNoYesNoDeployment complexityBinaryBinaryBinary + QtBinaryFigure 2: How Go compares to other programming languages for Yocto builds
🌐
Quora
quora.com › Why-is-Go-considered-to-be-much-faster-compared-to-other-compiled-languages-like-C-and-C
Why is Go considered to be much faster compared to other compiled languages like C and C++? - Quora
Answer (1 of 3): “faster” about languages is quite meaningless in industry in most frequent cases . You can write an efficient python program ( python is very slow) as you can write a terrible inefficent code in C/rust/C++ , in ASM or in any language . Algorithm you chose is the most important ...
🌐
Reddit
reddit.com › r/golang › is golang really a competitor to c++ ?
r/golang on Reddit: Is Golang really a competitor to C++ ?
March 21, 2024 -

So I have recently watched an interview where Ken Thompson was saying he got convinced to build Go after he read some C++ codebase. I also read some blogs saying the same.

But how can Go compete with C++ which has manual memory management ?

The reason people are using C++ is because of its Speed and ability to manually manage the memory right ?

How can Go which has GC be used to write Game development, HFT softwares, automobile softwares, embedded and expect the same result as that of a manually memory managed language?

Or is there any plan to add manual memory management to Go ? Which would make it really awesome ig ?

Here is the Google I/O conference

Ps: Beginner.

Edit: By competitor I meant the same things C++ does that go does it easier and better.

I think many people thought I was trying to make a language war here lol.

As i specifically mention above I'm a beginner and I was just trying to get the thoughts of experienced devs who used both.

🌐
Shawn's Blog
basicallyshawn.com › 2024 › 04 › 29 › go-vs-c-first-glance
Go vs. C++, First Glance | Shawn's Blog
April 29, 2024 - Go’s garbage collection, on the other hand, runs concurrently with the application and employs a mark-and-sweep algorithm. This algorithm can be further explored in the Go garbage collection guide (https://tip.golang.org/doc/gc-guide).
🌐
TFTUS Official Blog
tftus.com › blog › golang-vs-other-languages-a-comparative-analysis
Golang vs. Other Languages: A Comparative Analysis
December 16, 2025 - Golang, on the other hand, is designed to be compiled directly to machine code, making it faster and more efficient than Java. C++ is a popular language for high-performance applications, such as video games and operating systems.
🌐
CodiLime
codilime.com › blog › software development › backend › go vs. c++ — main differences: speed, benefits, exception handling
Go vs. C++ — Main Differences: Speed, Benefits, Exception Handling
September 23, 2021 - Go mixes the features of statically-typed languages, such as high performance and type safety, with the features of dynamically-typed and interpreted languages, such as conciseness, expressiveness, readability, and the ability to run code quickly.