Live data from Hacker News

Why we switched from Python to Go

getstream.io

201–210 of 406 posts

Re: Why we switched from Python to Go

#201
post #127

How do these shallow articles get upvoted so much ? they don't have much specific information except very generic "developer productivity". Let me give a specific example where moving to Go really helped our tooling: Go has some great interfaces, specifically their net & ssh client. In order to perform operations against some machines, we have to tunnel through bastions, however we'd also like the tool to work when a…

Because title starts with "Why". Psychological effect.

What exactly is the psychological effect tying the word "why" to an article getting more attention?

Re: Why we switched from Python to Go

#202

Why does anyone write web apps in Python? PHP? Ruby? Modern Java and Go are so much faster than the alternatives that it's stupid to consider anything else if performance is important. Golang and Java can manage over a half million HTTP responses a second. Node is pretty fast but why bother when Java is many times more mature in features, tooling, and and supports concurrency... And uses less ram and is usually faste…

Why does anyone write web apps in Python? PHP? Ruby? First: Because squeezing every last nanosecond's worth of performance out of your web app is actually an extremely rare problem to have. And if you truly cared about performance over programmer convenience, you'd practice what you preach and build your web apps in hand-rolled assembly, but I'd bet a lot of money that you don't do that. The typical web application -…

> has a bottleneck at the database and the network that dwarfs any overhead from language performance.

Or a bottleneck in a process which can be optimised into better data structures. Changing the language can only lower your constant cost and the scale - it will not change the complexity on its own, so it should be really the last resort.

Re: Why we switched from Python to Go

#203
post #140
post #6

Re: frameworks My experience with the language (building multiple production systems) is that the language itself is sort of it's own framework. You don't need to add much to build an application with the standard library. Which is a huge plus and makes things simpler.

That applies to all languages with exception of C, because they didn't want to standardize it as part of the language, hence we got ANSI C + POSIX instead.

Go provides built in functionality to develop web applications. Things like template rendering, routing, a generic SQL interface, etc. Which are libraries not commonly found on most languages. Python, OTOH, requires libraries like Flask, Jinja2, and SQLAlchemy to provide the same functionality Go provides as defaults. Thats my whole point.

Re: Why we switched from Python to Go

#204

Why does anyone write web apps in Python? PHP? Ruby? Modern Java and Go are so much faster than the alternatives that it's stupid to consider anything else if performance is important. Golang and Java can manage over a half million HTTP responses a second. Node is pretty fast but why bother when Java is many times more mature in features, tooling, and and supports concurrency... And uses less ram and is usually faste…

> Why does anyone write web apps in Python?

The new generation of Python web frameworks is pretty fast (check out Sanic[0][1] for example), Python has a huge growing ecosystem, you get rapid time to marked and if you find some part of your application to be the bottleneck, you can replace it with C/Rust, which you probably don't need, because your company won't ever scale as far.

[0] https://github.com/channelcat/sanic

[1] https://magic.io/blog/uvloop-blazing-fast-python-networking/

Re: Why we switched from Python to Go

#205
post #56

I think there's a great value in code being straight forward and simple and that is very much not appreciated among many programmers. A good language enables you to "compress" your code without making the code flow impossible to follow. A bad language encourages you to obfuscate the flow of the program using wacky abstraction techniques. Go doesn't exactly hit the sweet spot for semantic compression due to lack of co…

IMO Go has poor primitives that make even straightforward code needlessly complicated. Slices are probably the worst. Compare Python's way to inserting a value into a list: a.insert(i, x) With the way that the Go docs suggest: a = append(a[:i], append([]T{x}, a[i:]...)...) Sorting and for-range loops are other examples.

I prefer to the Go way. The python way gives people the impression that the insert operation is cheap. In fact, it is not.

Re: Why we switched from Python to Go

#206
post #69

Earlier quoted context omitted.

Everyone seems to say this and also to write really slow websites.

The vast majority of slow websites I've seen written with RoR were slow because the DB later want optimised. 1+n query problems, pulling way more data than needed and then processing it in Ruby, missing indices etc.

Either that or by slow views. URL generation is often a noticable culprit.

Re: Why we switched from Python to Go

#207
post #165

Earlier quoted context omitted.

I was wondering the same thing, and it frustrates me. I think people obviously enjoy using Python/Ruby or whatever for small scripts, and by inductive reasoning they think they can enjoy programming even larger projects in these languages. They also rationalize the slowness by pretending that performance doesn't matter or that the bottle neck is the database. They abuse the adage about "premature optimization" being…

> by pretending that performance doesn't matter or that the bottle neck is the database. Or, you know... You can actually measure those things. And unless you're growing like crazy, or have a massive initial audience, you're likely to find that 90%+ of the app time is spent in the database and your CPU time isn't even close to maxed out. Why would you assume people would pretend any of that is true?

Well, we've seen for example, Twitter do that. I saw some slides[0] that other day from sometime in 2007[1] where they said they were using Ruby and spawning 180 rails instances to handle 600 requests per second. Like, that's insane. A compiled language can handle that load with just one instance. It's nothing.

[0]: https://www.slideshare.net/Blaine/scaling-twitter/3-First_So...

Also, if your audience is small enough that a slow python can suffice, why even bother using a database server such as postgresql or mysql when you can just use sqlite and simplify the architecture?

EDIT:

[1] It's been 10 years since 2007 but people still do this more or less all the time. Write a webapp in js/ruby/python and spawn 20 instances of the application server

Re: Why we switched from Python to Go

#208
post #157

Earlier quoted context omitted.

I've been evaluating Cython for both code obfuscation and for using C based extensions to improve performance. Cython is pretty nice, but shipping binary only Python extensions can be such a pain, especially dealing with 2-byte vs 4-byte unicode representation issues. I need to try Go one of these days !

> shipping binary only Python extensions can be such a pain, especially dealing with 2-byte vs 4-byte unicode representation issues The issue with different Unicode builds was fixed 5 years ago, in Python 3.3: https://docs.python.org/3/whatsnew/3.3.html#pep-393-flexible...

Yes it's nice to see this is now fixed. In my case I need to support Python 2.7 though, and for Python 2.7 the only workaround I know of is shipping two binaries (2 byte and 4 byte encoding) then loading the correct module at runtime.

Re: Why we switched from Python to Go

#209
post #183

Wait just one minute, Thierry... Are you telling me that Python helped you create a viable tech-oriented newsfeed and activity stream business, serving 500 companies and more than 200Million "end users"? That sounds like a great incentive for any entrepreneur to get started with Python. You've gotten this far by using the language you've turned away from! Further, I'm confident you didn't solve every challenge you've…

You really hit the nail on the head. If someone is able to build a successful business with an easy to use language, that sounds like the language you want to start with.

Re: Why we switched from Python to Go

#210
post #42

>Go forces you to stick to the basics. This makes it very easy to read anyone’s code and immediately understand what’s going on. I’m not criticizing Go since I have no LoC in it, but in other restricted-and-flat languages and areas our company’s expertise quickly (read: in half a decade) went to the limit with no chance to turn the lang partly into dsl and level up. It is like playing rpg where you stuck to level 5 a…

> inability to create something that only your team can use and understand effectively means you’re locked to growing markets (bubbles) and never have real expertise and/or budget over bloated competition

Could you unpack that a bit further?

By "inability to create something that only your team can use and understand effectively", do you mean "inability to create something really powerful"? As it stands, it sounds like a good thing.

Post reply on HN