7 ms·
Is Golang significantly slower than c++ ? I thought Google had invented Golang to solve precisely these kinds of code for their internal use. I had thought mos
by sandGorgon 7y ago
Is Golang significantly slower than c++ ? I thought Google had invented Golang to solve precisely these kinds of code for their internal use.
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.
- mratsim 7y agoGolang didn't exist in the 90's though. Rewriting decades of core business logic would be a tremendous effort and amount of risk.
- hu3 7y agoWhy port something that's working fine?
- dgellow 7y ago> Is Golang significantly slower than c++ ? Depends the context, but in general, yes. C++ is very close to C on this aspect, trading memory safety for performances. Concerning google, as far as I know the codebase is mostly C++, Java, and python. Go will surely eat a bit of the Java and Python projects but it’s unlikely to see C++ being replaced any time soon.
- penagwin 7y ago> Is Golang significantly slower than c++ ? > Depends the context, but in general, yes. I don't believe this is the case. Most optimized, natively compiled languages all perform similarly. Go, C, CPP, Rust, Nim, etc. I'm sure there are edge-cases where this isn't the case, but they all perform roughly the same. The performance rift only starts when you introduce some form of a VM, and/or use an interpreted language. Even then, under certain workloads their optimizations can put them close to their native counter parts, but otherwise are generally slower. The real reason Google didn't re-write this in Go is likely because the library is already finished, it works, a re-write would require more extensive testing, etc. Why spend precious man-hours on a needless re-write?
- spullara 7y agoGolang and Java have similar performance characteristics. I would not put it in the same class as C/CPP/Rust. https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/go.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- recursive 7y agoPresumably less startup time and JIT.
- spullara 7y agoDepends on if the Java code is ahead of time compiled or not. The AOT compiler is included in the latest JDKs.
- igouy 7y agofwiw AoT with Substrate VM https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/java-substratevm.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- igouy 7y agoThe run times are seconds not micro-seconds. How many seconds do you suppose startup time is for those tiny programs? How many seconds do you suppose JIT is for those tiny programs?
- igouy 7y ago> Depends the context, but in general, yes. For example? Otherwise we just have: yes it is! no it isn't! https://en.wikipedia.org/wiki/Argument_Clinic https://en.wikipedia.org/wiki/Argument_Clinic
- EpicEng 7y ago>I dont think porting is the big issue. Why do it in the first place? Just because you can? The code works and it's written in a popular language which plenty of people know. What's the upside?
- shuzchen 7y agoI would much prefer a library such as this be done in C/C++ so it could be packaged up as a library that could be called from other languages. Pretty much every major language has some form of FFI to call out to C/C++ code. This way, you can get consistent behavior if you need to parse robots.txt in python vs ruby vs java vs etc.
- holy_city 7y agoI know it's a meme to say "C is not C++" but in this context C is really not C++. Calling into C through FFI is significantly easier than calling into C++. Very few languages have decent FFI with C++, while many have great support for C.
- pjmlp 7y agoQuite the contrary, three Google employees that are very vocal against C++, and well known personalities, got fed up using it and created Go, eventually they got support from upper management. Java and C++ still run most of Google.
- UncleMeat 7y ago> I had thought most of the systems code inside Google would be golang by now. Google has gazillions of lines of system code already built. Why rewrite everything in go? There is so much other stuff to do. All rewriting achieves is add additional risk because the new code isn't battle tested.
- geuszb 7y agoGolang, as a garbage-collected execution environment, suffers from lousy tail latency
- _rlh 7y agoActually Go has the reputation of having solved many runtime problems including the GC tail latency problem.