Is Python is too Slow?

No alt text provided for this image

I had an interesting question in the comments on my YouTube video 'Python for Everything'. What do you do when Python is just too slow? It's a common question and I wanted to share my reply. Comment back with your thoughts.


Yes. Python is slow and the interesting thing is that in most languages that results in Yet Another Language to address the slowness. Not in Python. For example, Python is horrible as a data science language because it's arrays perform badly. The answer? Someone developed a super-fast array processing engine in C called NumPy and wrote a Python wrapper around it so Python is now very fast with arrays and this was extended to dataframes via Pandas. This is a common theme. PyOpenGL is wrapper that uses the OpenGL libraries to get fast dynamically perspective graphics. The key is to find the bottlenecks and optimize them. There may be libraries available with can help. Another example, PyGame supports game development by wrapping around C libraries and there are many such libraries for other uses. If you have a C library, you can write a Python wrapper and use it to speed things up.  Also, there are multiple Python interpreters but most only know about CPython. Another, much faster alternative is call PyPy. See https://www.pypy.org/ This can improve performance massively. In my experience, every language has weaknesses, Python just taps into another language library to get around them. And because there is such a massive Python development community, these bottlenecks are disappearing quickly via new packages. 

Zhaoxun Yan

Chief Executive Officer at Wuhan Hengji technologies

4 年

Not suitable for CPU intensive programming!

回复

Bryan Cafferky good informative blog

回复
Steeve Brechmann

AI/ML & HPC | Computational Physicist

4 年

And don't forget Dask-Rapids for big data in Python!

要查看或添加评论,请登录

Bryan Cafferky的更多文章

社区洞察

其他会员也浏览了