n-body problem at shootout.alioth.debian.org
horpner at yahoo.com
Fri Oct 6 22:30:20 CEST 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.
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