/!\ This page is primarily intended for Mercurial's developers.

Pypy Plan

Status: In Progress

Main proponents: Pierre-YvesDavid, MaciejFijalkowski, MartijnPieter, BryanO'Sullivan

Pypy is a python interpreter with a Tracing JIT compiler, using it could significantly boost our performance in some situation.

1. Description

The Python language is powerful but slow. Using a Jit compiler can give us a lot of that speed back without having to translate large part or Mercurial into C. However there is multiple challenge ahead:

All kind of stuff can go here, solution description / alternative solution etc

2. Current approach

3. Failing Tests

4. CFFI experiment

Using the CPython API in C makes it hard for pypy to do nice optimisation. Calling our C code through https://cffi.readthedocs.org/en/latest/ would fix that. However, cffi just allow function call, not building full compatible Python object directly from C. As a result we probably need to keep a CPython API and a CFFI version of our code in parallel. CPython will still use it's carefully build object using the CPython API and PyPy will use pure Python object calling C function through CFFI as it should be able to optimise the pure Python object overhead away.

All our C code must be audited and sorted in the following categories

4.1. Python Version is Just Fine

The pure version is already as fast as the C version.

Link to example: 'to be added'

4.2. Python Version need rework

The pure version should be as fast as the C version, but is currently not.

Link to example: 'to be added'

4.3. Simple Function that need cffi version

Link to example: 'to be added'

4.4. Complex Class that need cffi version

Link to example: 'to be added'

4.5. C Code calling Python code back

This will be fun.

Link to example: 'to be added'

5. Benchmark

We plan to have a look at the performance of the following command.

6. Roadmap

7. See Also

CategoryDeveloper CategoryNewFeatures

PyPyPlan (last edited 2016-02-26 09:56:30 by Pierre-YvesDavid)