[pypy-dev] Exposing rpython based functions to cpython vm.

Yury V. Zaytsev yury at shurup.com
Mon Jun 19 15:55:12 EDT 2017


On Mon, 19 Jun 2017, Armin Rigo wrote:

> Answered on https://stackoverflow.com/questions/44629893/invoke-rpython-based-functions-from-standard-python-code

I would add to that that in the case that the idea was to take some code 
out of hot loops, translate it into RPython so that it runs faster, and 
finally import it into cPython, then (as Armin elaborated) you're missing 
the point of RPython. However, here are few alternatives to consider:

One go-to solution would be to use Cython which lets you easily blend 
Python / C up to the point of writing restricted C with Python syntax, and 
import resulting Cython modules into your program running under cPython.

A more principled solution would be to port your application to PyPy (if 
any porting would be required at all), and enjoy the JIT, or else dig 
around trying to figure out why exactly is that you're not getting the 
speedups you were hoping for, and make PyPy better in the process!

-- 
Sincerely yours,
Yury V. Zaytsev


More information about the pypy-dev mailing list