[hcs-d] accelerating python

Zak Stone zstone at gmail.com
Fri Oct 9 15:21:31 EDT 2009


I wish I could use Psyco, but it isn't compatible with 64-bit
machines, and there are no plans for that to change. (Following a
previous thread, I don't want to attempt to run 32-bit Python on a
64-bit machine -- it's very useful to have 16 GB of RAM.)

Compatibility with NumPy arrays would be a huge win -- I will look
into both Cython and SWIG, though I believe Google's Summer of Code
enhanced Cython's ability to work with NumPy. The Cython site seems to
be down right now, unfortunately:

http://downforeveryoneorjustme.com/cython.org

As a sidenote, I'm not sure the setuptools system is a good thing,
even though it seems convenient at times:

http://www.b-list.org/weblog/2008/dec/14/packaging/

Zak


On Fri, Oct 9, 2009 at 2:34 PM, Jeremy Hoon <jeremy.d.hoon at gmail.com> wrote:
> SWIG can be really powerful, and I know that on Ubuntu it is integrated into
> python setuptools, making the build process less of a pain. SWIG also gives
> you easy interoperation with numpy arrays if you're handling larger amounts
> of data. If this is more than a quick one-off it may be worth the pain.
>
> On Oct 9, 2009, at 1:44 PM, Ivan Krstić <krstic at solarsail.hcs.harvard.edu>
> wrote:
>
>> On Oct 8, 2009, at 2:51 PM, Zak Stone wrote:
>>>
>>> Has anyone on this list ever played with Cython (
>>> http://www.cython.org/ ) or other techniques for accelerating Python
>>> code and linking in C code?
>>
>> Cython (and its single-maintainer predecessor, Pyrex) are excellent.
>> SWIG is substantially more complicated; I don't recommend it unless
>> you're dealing with binding particularly complex code.
>>
>> You'll also want to look at Psyco, which is a Python in-place pseudo-
>> JIT that often produces large speedups in tight loops operating on
>> primitive types. It's usually a great first pass approach when
>> optimizing algorithmic code, since it requires no actual work on your
>> behalf.
>>
>> --
>> Ivan Krstić <krstic at solarsail.hcs.harvard.edu> | http://radian.org
>>
>> _______________________________________________
>> hcs-discuss mailing list
>> hcs-discuss at lists.hcs.harvard.edu
>> http://lists.hcs.harvard.edu/mailman/listinfo/hcs-discuss
>


More information about the hcs-discuss mailing list