n-body problem at shootout.alioth.debian.org
Neil Cerutti
horpner at yahoo.com
Fri Oct 6 16:30:20 EDT 2006
On 2006-10-06, Peter Maas <peter.maas at somewhere.com> wrote:
> I have noticed that in the language shootout at
> shootout.alioth.debian.org the Python program for the n-body
> problem is about 50% slower than the Perl program. This is an
> unusual big difference. I tried to make the Python program
> faster but without success. Has anybody an explanation for the
> difference? It's pure math so I expected Perl and Python to
> have about the same speed.
The Perl program is obfuscated to speed it up; it uses an array
of planet property arrays instead of objects.
Of course, perhaps that's the right way to do it in Perl.
A python solution that indexed lists instead of looking up
attributes of objects might be faster.
--
Neil Cerutti
We're not afraid of challenges. It's like we always say: If you
want to go out in the rain, be prepared to get burned.
--Brazillian soccer player
More information about the Python-list
mailing list