Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #59375

pypy and ctypes

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Peter Chant <pete@petezilla.co.uk>
Newsgroups comp.lang.python
Subject pypy and ctypes
Date Thu, 14 Nov 2013 00:39:20 +0000
Lines 18
Message-ID <omidlaxggl.ln2@phoenix.fire> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net NhvZUWpPHYDov/KmcKE7SA+QBTH5rnOSePD7feTwCv3KtK9us=
X-Orig-Path phoenix.fire!not-for-mail
Cancel-Lock sha1:assUrl7qg+pneBkK4iZ0kddBP3k=
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131102 Thunderbird/17.0.10
Xref csiph.com comp.lang.python:59375

Show key headers only | View raw


I'm looking to speed up some python code.  Replacing the python 
interpreter with pypy was impressive.  I noted that use of ctypes (in 
cython?), specifically declaring variables as below, was reported as 
giving a useful result:

cdef float myvar
cdef int i

under cython can provide a useful speed increase even if sections of 
code are not re-written in C.  Does this also work in PyPy?  From 
googling I keep getting pointed at ffi - but that seems to relate more 
to calling c-libraries rather than what I'm trying to do - seeing if 
there are any simple speed ups by declaring variables.

Or is it that - if I keep the code as simple as possible, PyPy is about 
as fast as you can get?

Pete

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

pypy and ctypes Peter Chant <pete@petezilla.co.uk> - 2013-11-14 00:39 +0000
  Re: pypy and ctypes Neil Cerutti <neilc@norwich.edu> - 2013-11-14 15:13 +0000
    Re: pypy and ctypes Peter Chant <pete@petezilla.co.uk> - 2013-11-14 23:05 +0000

csiph-web