by evgen · 7y ago · 0 comments
1) write everything in python
2) yeah, the performance here is good enough so ship it
3) there is no 3
There are very few situations where performance is going to be an issue for you where there is not an existing C module solution that will solve the problem for you. The tired old 'python is slow' trope is getting more and more irrelevant every day. There are other aspects of the language that may make it a mediocre solution to the problem at hand, but out in the real world most people are simply getting the job done with python.
We certainly shipped (using django) and it was certainly slow, and remains a painfully slow very successful enterprise app.
I’m not arguing that the slowness is deal breaking, but it is slow, and it does, routinely, break the SLAs its supposed to meet.
So... unusably slow? no.
...but slow? yes, it really is.
imo. your milage may vary. /shrug
If there are performance issues, rewriting part of a Python application in C is much less likely than refactoring it, without using other languages, to use an existing high performance library.
Application-specific Python extensions are usually intended to allow scripting of the application, with little concern for Python performance (which is the same as doing the same thing without scripting).
New foreign language Python extensions are usually found in new Python libraries, to make existing proven C or C++ libraries available to Python applications or to improve on existing Python libraries.
It's a miracle they shipped it at all.
You can ship your own clone of Reddit next week, with blazingly fast code, running on two tiny VMs and supporting more load than Reddit, but would it be successful?
https://hackernoon.com/which-is-the-fastest-version-of-pytho... has a benchmark that includes 3.7.