本文介绍了如果PyPy快6.3倍,为什么我不应该在CPython上使用PyPy?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于项目,我已经听到很多。他们声称它比 CPython 解释器快6.3倍。 speed.pypy.org rel = noreferrer>其网站。

I've been hearing a lot about the PyPy project. They claim it is 6.3 times faster than the CPython interpreter on their site.

每当我们谈论诸如Python之类的动态语言时,速度是首要问题之一。为了解决这个问题,他们说PyPy快6.3倍。

Whenever we talk about dynamic languages like Python, speed is one of the top issues. To solve this, they say PyPy is 6.3 times faster.

第二个问题是并行性,臭名昭著的(GIL)。为此,PyPy表示。

The second issue is parallelism, the infamous Global Interpreter Lock (GIL). For this, PyPy says it can give GIL-less Python.

如果PyPy可以解决这些巨大的挑战,那么它的哪些弱点正在阻碍广泛采用?也就是说,是什么阻止了像我这样的人(一个典型的Python开发人员)立即转而使用PyPy

If PyPy can solve these great challenges, what are its weaknesses that are preventing wider adoption? That is to say, what's preventing someone like me, a typical Python developer, from switching to PyPy right now?

推荐答案








  1. PyPy,就像其他人很快提到的那样,对C扩展的长期支持。它具有 支持,但通常速度低于Python,而且充其量也很不稳定。因此,很多模块只是 require CPython。 PyPy现在支持numpy 。某些扩展程序仍不受支持(熊猫,SciPy等),请先查看进行更改。

  2. Python 3支持 刚刚稳定!自2014年6月20日起,!

  3. PyPy有时对实际上不是更快,很多人使用Python来实现。这些是短时间运行的程序,它们执行的操作简单而又小。由于PyPy是JIT编译器,因此其主要优点来自运行时间长和简单的类型(例如数字)。坦率地说,与CPython相比, PyPy的JIT之前速度很差

  4. 惯性。迁移到PyPy通常需要重新设置工具,对于某些人和组织而言,这简直是太多的工作。

  1. PyPy, as others have been quick to mention, has tenuous support for C extensions. It has support, but typically at slower-than-Python speeds and it's iffy at best. Hence a lot of modules simply require CPython. PyPy now supports numpy. Some extensions are still not supported (Pandas, SciPy, etc.), take a look at the list of supported packages before making the change.
  2. Python 3 support has just reached stable! As of 20th June 2014, PyPy3 2.3.1 - Fulcrum is out!
  3. PyPy sometimes isn't actually faster for "scripts", which a lot of people use Python for. These are the short-running programs that do something simple and small. Because PyPy is a JIT compiler its main advantages come from long run times and simple types (such as numbers). Frankly, PyPy's pre-JIT speeds are pretty bad compared to CPython.
  4. Inertia. Moving to PyPy often requires retooling, which for some people and organizations is simply too much work.

这些是影响我的主要原因,我会说。

Those are the main reasons that affect me, I'd say.

这篇关于如果PyPy快6.3倍,为什么我不应该在CPython上使用PyPy?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 08:26