n-body problem at shootout.alioth.debian.org

igouy at yahoo.com igouy at yahoo.com
Sun Oct 8 01:51:28 CEST 2006


Peter Maas wrote:
> Paul McGuire wrote:
> > The advance method is the most fertile place for optimization, since it is
> > called approximately n(n-1)/2 times (where n=2E7).  I was able to trim about
> > 25% from the Python runtime with these changes:
> [...]
>
> My results:
>
> Your changes: 18% runtime decrease
> Your changes + objects->lists: 25% runtime decrease
>
> The Python program is much closer to the Perl program then (~2250 vs 1900 sec)
> but replacing the objects by lists is not worth the effort because the gain is
> small and the Python program becomes less readable.
>
> Taking arrays (from module array) instead of lists increases runtime by 19%!
>
> If it weren't for the shootout I would of course take psyco and numpy.
>
> --
> Regards/Gruesse,
>
> Peter Maas, Aachen
> E-mail 'cGV0ZXIubWFhc0B1dGlsb2cuZGU=\n'.decode('base64')

We can have our Python and Psyco too :-)

http://shootout.alioth.debian.org/gp4sandbox/fulldata.php?test=nbody&p1=python-0&p2=psyco-4&p3=iron-0&p4=psyco-3




More information about the Python-list mailing list