Python: PyPy: SciPy / Chi-square distribution?

I have a Python project where performance is pretty important. Honestly, I know that Python (at least pure Python) is not the best tool for this work, but I use it anyway because I want to distribute a very simple clean python version of some research code so that people can modify it, and etc. without the need to create a complex environment. (I also have an alternative implementation written in D that is much faster, but harder to hack.)

I used PyPy as my interpreter and recommended it to everyone who used this code. It gave me a reasonable speed. Then I decided to set up the algorithm and access some functions from SciPy (all I need is a CDF, a survival function, and an inverse CDF for Chi-square distribution). I tried running my code in CPython to access SciPy, and it is slow, like molasses.

Can anyone suggest one of three things:

  • A treasure that will allow me to use some SciPy pieces from PyPy.

  • Better yet, pure python implementation of the chi-square distribution functions I need, under a liberal license?

  • Jit way to bottlenecks from CPython? I know Psyco, but it looks unchanged and only works on 32-bit systems.

+4
source share
1 answer

SciPy does not work on PyPy yet, although there is some work to do it pretty quickly if you are ready to use the night hours and make minor adjustments, so you only use the supported numpy subset (which expands quickly), I would advise you to just try porting the functions SciPy in Python so far, if time is rushing at you (they should be relatively simple, but still work). In addition, there are many tools on the PyPy website to make this happen even earlier :)

EDIT: this matplotlib runs on pypy by embedding CPython: http://baroquesoftware.com/~fijal/extreme_hacks.png

EDIT2: read http://morepypy.blogspot.com/2011/12/plotting-using-matplotlib-from-pypy.html for an example.

Cheers fijal

+5
source

Source: https://habr.com/ru/post/1385181/


All Articles