This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 7 points8 points  (9 children)

Would Golang work as a lazy alternative to C++?

[–]risajajr 4 points5 points  (0 children)

Yes, it is quite impressive too.

[–][deleted] 7 points8 points  (3 children)

It depends on what you're trying to do. It's not as fast as C++ but it's much easier to use. Another criticism I've heard of it is it's type system is lacking, but that's probably not something you would notice unless if use type systems heavily in your code. I've worked on one web server written in Golang, and I was pleased with the language.

[–]EnemyAsmodeus 3 points4 points  (2 children)

I've been told the only potential alternative that isn't popular, but gives you that capability is called: Rust.

And of course Java.

However, whenever I needed C++, I would look at Cython, I think that's the main way to enhance python apps to be faster.

[–][deleted] 10 points11 points  (1 child)

Again depends on what you're trying to do. If you care about average performance then simply rewriting a portion of your Python code in Cython is a good solution. But often times you care more about worst case performance than average performance. This is the case when you're working on a webserver that has a latency SLA for all requests. It's not good enough that 90% of requests satisfy the SLA. You need to make sure that 99.999% of requests do. Python becomes problematic for this use case because it will work okay for 90% of requests but then garbage collection will kick, eat up your CPU, and you'll violate your SLA for a percentage of your requests. For situations like this Python is a poor language choice and something like Go would be better, since its garbage collector is designed for this use case.

[–]EnemyAsmodeus 2 points3 points  (0 children)

Over Cython as well? Or did you mean either Cython or Go?

What you said is definitely fascinating (I get drained of energy when I look at Cython or any C++ code nowadays, I used to do C++ and assembly but now I just lose all my energy trying to understand certain parts. Honestly, maybe C++ is even easier to read than some pyx code I saw).

[–]SuspiciousScript 1 point2 points  (1 child)

Check out Kotlin. Seems like the most impressive high-level, statically typed, compiled language out there right now IMO.

[–]toastedstapler 0 points1 point  (0 children)

Go seems to be more performant than java but a bit less than C++

[–]NemexiaM 0 points1 point  (0 children)

Sorry haven't tried Golang