To clarify, these are python libraries, imported into the main python
script.  It's these libraries that are just python library API wrappers for
some underlyinig synchronous C code.  Had a quick browse a CFFI, but this
seems more related to call 'C' directly from a Python scripts rather than
'wrapping' it up as a python library.  Since these libraries are not mine,
I'd prefer to stay with the current model rather than discard the library
wrapper and use CFFI instead.

-----Original Message-----
From: Andy Baker [mailto:a...@pistuffing.co.uk] 
Sent: 01 July 2015 14:15
To: 'Cory Benfield'
Cc: 'pypy-dev@python.org'
Subject: RE: [pypy-dev] pypy 2.2.1 performance on Raspian

Hi Cory,

I didn't write the 'C' code or the Python wrappers myself but I have
modified the 'C' source code and added new python wrapper function - they
are for the Raspberry Pi RPiGPIO and RPIO hardware integration code.  The
"wrappers" are very thin layers defining to the Cpython interpreter (or pypy
JIT) how to map the Python call to the 'C' equvalent call along with
exceptions and control of the GIL.  There's no state stored within this
'wrapper' code - the 'C' code blocks returning OK, or an error which raises
a Python exception.  I'll look at CFFI to see if that sheds any light.

Andy

-----Original Message-----
From: Cory Benfield [mailto:c...@lukasa.co.uk]
Sent: 01 July 2015 13:48
To: Andy Baker
Cc: pypy-dev@python.org
Subject: Re: [pypy-dev] pypy 2.2.1 performance on Raspian


> On 1 Jul 2015, at 09:58, Andy Baker <a...@pistuffing.co.uk> wrote:
> 
> I am trying pypy as a performance increase over CPython.  My code uses
standard python libraries (not numpy), plus 2 'C' libraries accessing
Raspberry Pi GPIO hardware with python wrappers.  I have compiled both with
pypy (sudo pypy setup.py install).  The pypy version runs with no problems
but is 2.5 times slower than CPython.  From the performance stats, I believe
2.2.1 should be on average 6 times faster.  I presume it's my 'C' python
libraries which are the cause of the reduced performance.  What do I need to
do to make these private libraries pypy compatible?
> 

When you say you have Python wrappers, how have you written them? Generally
PyPy works best with Python interfaces written using CFFI[0].

Cory

[0]: https://cffi.readthedocs.org/en/latest/

_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to