python slow, pypy fast

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

python slow, pypy fast

James Alford
Hi All

After reading a couple of articles on this site about parallel
programming I came across this recent article talking about python
being slow compared to c.  The comments is where it becomes
interesting as a couple of people compare the benchmark results for
cython and pypy.

Python vs C in compute-bound workloads
http://www.futurechips.org/tips-for-power-coders/python-compute-bound-workloads.html

Pypy seems quite fast.  What I want to know is should you be aiming to
develop python with pypy or should you really concentrate on python 3?

James
_______________________________________________
melbourne-pug mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/melbourne-pug
Reply | Threaded
Open this post in threaded view
|

Re: python slow, pypy fast

Richard Jones-7
On 30 May 2011 14:48, James Alford <[hidden email]> wrote:
> Pypy seems quite fast.  What I want to know is should you be aiming to
> develop python with pypy or should you really concentrate on python 3?

Yes, pypy is really very fast for almost all benchmarks they throw at
it. Your question cannot be answered without knowing what you're
developing. Off the top of my head:

- Does your application need serious performance using regular Python code?
- Can your performance critical bits be coded in C or cython?
- Do you need to use existing libraries?

All of these questions will help you decide between python2, python3 and pypy.


     Richard
_______________________________________________
melbourne-pug mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/melbourne-pug
Reply | Threaded
Open this post in threaded view
|

Re: python slow, pypy fast

James Alford
On Mon, May 30, 2011 at 2:51 PM, Richard Jones <[hidden email]> wrote:

> On 30 May 2011 14:48, James Alford <[hidden email]> wrote:
>> Pypy seems quite fast.  What I want to know is should you be aiming to
>> develop python with pypy or should you really concentrate on python 3?
>
> Yes, pypy is really very fast for almost all benchmarks they throw at
> it. Your question cannot be answered without knowing what you're
> developing. Off the top of my head:
>
> - Does your application need serious performance using regular Python code?
> - Can your performance critical bits be coded in C or cython?
> - Do you need to use existing libraries?
>
> All of these questions will help you decide between python2, python3 and pypy.
>
>
>     Richard
> _______________________________________________

Hi Richard

Sorry, I meant it as a general question.
_______________________________________________
melbourne-pug mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/melbourne-pug
Reply | Threaded
Open this post in threaded view
|

Re: python slow, pypy fast

Richard Jones-7
On 30 May 2011 15:02, James Alford <[hidden email]> wrote:

> On Mon, May 30, 2011 at 2:51 PM, Richard Jones <[hidden email]> wrote:
>> On 30 May 2011 14:48, James Alford <[hidden email]> wrote:
>>> Pypy seems quite fast.  What I want to know is should you be aiming to
>>> develop python with pypy or should you really concentrate on python 3?
>>
>> Yes, pypy is really very fast for almost all benchmarks they throw at
>> it. Your question cannot be answered without knowing what you're
>> developing. Off the top of my head:
>>
>> - Does your application need serious performance using regular Python code?
>> - Can your performance critical bits be coded in C or cython?
>> - Do you need to use existing libraries?
>>
>> All of these questions will help you decide between python2, python3 and pypy.
>
> Sorry, I meant it as a general question.

But what I'm saying is there's no general answer.

Even though I'd love to I can't use Python 3 in my day job because of
the legacy codebase that needs to be migrated.

I can't use pypy for the website because it doesn't run Zope yet. We
don't need it there though because there's already C code making the
slow bits fast.

Nor can I use pypy for currently-slow analysis programs that need to
connect to Oracle, because the cx_Oracle module isn't available for
pypy yet. If I really cared about speeding those up I could probably
write some quick cython to do so.

We have one guy in our company using pypy because he does analysis of
data from other sources that he can happily slurp into a pypy program
and crunch in ten different ways.


     Richard
_______________________________________________
melbourne-pug mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/melbourne-pug
Reply | Threaded
Open this post in threaded view
|

Re: python slow, pypy fast

James Alford
Right, thanks.

That breaks it down for me.  This question is really about a new
project that will do a lot of data crunching that I was going to code
in c which the python code will call out to.  I was looking at pypy
and thought that might be a an alternative to the c code (it still may
be).

On Mon, May 30, 2011 at 3:17 PM, Richard Jones <[hidden email]> wrote:

> On 30 May 2011 15:02, James Alford <[hidden email]> wrote:
>> On Mon, May 30, 2011 at 2:51 PM, Richard Jones <[hidden email]> wrote:
>>> On 30 May 2011 14:48, James Alford <[hidden email]> wrote:
>>>> Pypy seems quite fast.  What I want to know is should you be aiming to
>>>> develop python with pypy or should you really concentrate on python 3?
>>>
>>> Yes, pypy is really very fast for almost all benchmarks they throw at
>>> it. Your question cannot be answered without knowing what you're
>>> developing. Off the top of my head:
>>>
>>> - Does your application need serious performance using regular Python code?
>>> - Can your performance critical bits be coded in C or cython?
>>> - Do you need to use existing libraries?
>>>
>>> All of these questions will help you decide between python2, python3 and pypy.
>>
>> Sorry, I meant it as a general question.
>
> But what I'm saying is there's no general answer.
>
> Even though I'd love to I can't use Python 3 in my day job because of
> the legacy codebase that needs to be migrated.
>
> I can't use pypy for the website because it doesn't run Zope yet. We
> don't need it there though because there's already C code making the
> slow bits fast.
>
> Nor can I use pypy for currently-slow analysis programs that need to
> connect to Oracle, because the cx_Oracle module isn't available for
> pypy yet. If I really cared about speeding those up I could probably
> write some quick cython to do so.
>
> We have one guy in our company using pypy because he does analysis of
> data from other sources that he can happily slurp into a pypy program
> and crunch in ten different ways.
>
>
>     Richard
> _______________________________________________
> melbourne-pug mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/melbourne-pug
>
_______________________________________________
melbourne-pug mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/melbourne-pug
Reply | Threaded
Open this post in threaded view
|

Re: python slow, pypy fast

Rasjid Wilcox
Hi all,

Just as an aside - I wrote a small script that solves the 'Solitair'
puzzle (32 pegs in a cross shape with a single peg missing in the
middle) in python.

Python 2.6 on Ubuntu 10.04 - approx 26 seconds
pypy 1.4.1 - approx 5.5 seconds

Should try pypy 1.5 now it is out.

Cheers,

Rasjid.

_______________________________________________
melbourne-pug mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/melbourne-pug