4 ms·
When you look at what you need in Python to get semi-decent performance: - C library everywhere ( network, serialization ... ) - server that manages process e
by Thaxll 8y ago
When you look at what you need in Python to get semi-decent performance:
- C library everywhere ( network, serialization ... )
- server that manages process ect ...
At some point if you need that kind of things just pickup a language that does it out of the box.
- jniedrauer 8y agoI'd like to see a more streamlined model for generating swagger files/generating APIs from swagger files in Go, but I mostly agree.
- tiangolo 8y agoYeah, the idea is to take inspiration from Go and similar languages, using the new async (coroutine) features in Python that give it better concurrency handling, and the benefits of types. Without having to deal with a lower-level language.
- tiangolo 8y agoMaybe, but Python is still quite easy to pick, the only one that can do Deep Learning and Machine Learning well, etc. So, if we can use it, take advantage of its benefits and have tools like this that simplify everything without too many constraints, I would say it's a good tradeoff.
- m_ke 8y agoYeah for data science and CRUD workloads python is great. The performance difference between go and python in those settings are negligible and python wins out on ease of use and ecosystem.
- tiangolo 8y agoExactly. Totally agree.
- grumpopotamus 8y ago>Maybe, but Python is still quite easy to pick, the only one that can do Deep Learning and Machine Learning well, etc. This is such a terrible state of affairs. There are so many times I've wanted to generate synthetic training data efficiently and iterate in a tight training loop where I've gone back and forth endlessly between trying to get Python to be fast and trying to get the training part to work in another language.
- tiangolo 8y agoIf the bottleneck is computation, make sure you are using Numpy, Pandas, Dask, and the whole family of scientific Python. If it's IO, check asyncio tools. E.g. aiofiles.
- linuxftw 8y ago> C library everywhere ( network, serialization ... ) I view this as a strong benefit in python. Write your app, and if you need to really squeeze performance in some critical area, writing a C/C++ extension is simple enough.
- j88439h84 8y agoPypy is really fast.
- jerf 8y agoRelative to CPython, yes. In the grand landscape of programming language performance, it tops out at middling on practical code.
- tiangolo 8y agoI guess the tradeoff is speed and convenience. If we wanted to have the absolute best performance, we would have to write web apps in C. But it would be quite more cumbersome.
- jerf 8y agoIt's not a value judgment, which I feel (though I can't prove) you are still reading it is. But it isn't. It just is what it is. The performance characteristics of various technologies just... are. It's a mistake to read too much value judgment into it. I don't "hate" PyPy because it's not as fast as C, or love C because it's fast. They've got all sorts of characteristics, and a professional engineer ought to understand them as dispassionately as possible to make decisions about how to solve problems. PyPy is a solution to "my Python code is running slowly". For very little effort you can obtain a very cheap speedup. It may not be all you need, but it's very engineer-effort cheap. But it certainly isn't a solution to "my Python code is running slowly but I need it to run at C speeds", and there are a ton of other solutions to the problem "My Python code is running slowly", since Python is such a slow language on its own terms. (By contrast, "my C code is running slowly and I've already profiled it a lot, etc." is a huge problem.)
- tiangolo 8y agoYep, agree. Thanks for the clarification.
- tiangolo 8y ago