Python performance

Michael Hudson mwh21 at cam.ac.uk
Tue Mar 7 23:01:09 CET 2000


claird at starbase.neosoft.com (Cameron Laird) writes:

> >few days.  You just can't make Python fast for this (at present).
> >(and to those that say "implement those bits in C": go away, that's
> >not the point I'm making here).
> >
> >I ended up translating it to Haskell.
> Cool!  Have you written that up?  I'd like to
> see a project where Haskell was chosen over
> Python for performance.

Well, it's for a computational project so I suspect the university
authorities would take a dim view of me spreading it too far and wide
...

It is *much* faster in Haskell though (like, a hundred times).  I
haven't really optimized the Python, though.

> >PS: Before some bright spark suggests I use NumPy: I've been doing
> >number theory ...
> What kind of number theory? 

Elliptic curve stuff (computing the size of the E(k) for an elliptic
curve E and finite field k).  Fairly hairy (I believe I'm at about the
only university in the world where we do this kind of thing as
undergraduates).

> Can you say this
> in other words?  Are you after very fast "ex-
> tended-precision" arithmetic, good support
> for lazy {maps,sequences,iterators,...}, that
> sort of thing?

Just fairly fast integer operations would do.  Also Haskell's
algebraic data types and general syntactic cuteness were quite a good
fit for the problem.

>  This is number theory over the
> natural numbers?

I think if I knew what I was talking about, I'd realize it was over
the field of p-adic fractions.

> If you're simply willing to express the calcu-
> lations of the prime number theorem in terms
> of Mayan calendrical algorithms for least com-
> mon multiple, you can probably find Python
> accelerators.  That's surely a small price to
> pay.

:-)

Cheers,
M.

-- 
very few people approach me in real life and insist on proving they are
drooling idiots.                         -- Erik Naggum, comp.lang.lisp



More information about the Python-list mailing list