What does PyPy have to offer over CPython, Jython, and IronPython?

后端 未结 4 379
南旧
南旧 2021-01-30 22:41

From what I have seen and read on blogs, PyPy is a very ambitious project. What are some advantages it will bring to the table over its siblings (CPython, Jython, and IronPython

相关标签:
4条回答
  • 2021-01-30 22:44

    In case that Python gets a real JIT I think it's going to be as fast as any other implementation.

    The advantage is that it's much easier to implement new features. One can see this today by observing the library. Often modules are written in Python first and then translated into C.

    0 讨论(0)
  • 2021-01-30 22:49

    The most important feature is of course the JIT compiler. In CPython files are compiled to bytecode (.pyc) or optimized bytecode (.pyo) and then interpreted. With PyPy they will be compiled to native code. PyPy also includes Stackless Python patches, including it's impressive features (tasklet serialization, light threads etc.)

    0 讨论(0)
  • 2021-01-30 22:51

    cross-platform compatibility

    Yes

    0 讨论(0)
  • 2021-01-30 23:01

    PyPy is really two projects:

    • An interpreter compiler toolchain allowing you to write interpreters in RPython (a static subset of Python) and have cross-platform interpreters compiled standalone, for the JVM, for .NET (etc)
    • An implementation of Python in RPython

    These two projects allow for many things.

    • Maintaining Python in Python is much easier than maintaining it in C
    • From a single codebase you can generate Python interpreters that run on the JVM, .NET and standalone - rather than having multiple slightly incompatible implementations
    • Part of the compiler toolchain includes an experimental JIT generator (now in its fifth incarnation and starting to work really well) - the goal is for a JITed PyPy to run much faster than CPython
    • It is much easier to experiment with fundamental language features - like removing the GIL, better garbage collection, integrating stackless and so on

    So there are really a lot of reasons for PyPy to be exciting, and it is finally starting to live up to all its promises.

    0 讨论(0)
提交回复
热议问题