[Python-3000] C API for ints and strings

Nicholas Bastin nick.bastin at gmail.com
Tue Sep 11 11:20:45 CEST 2007


On 9/11/07, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> > 3.0: 10 loops, best of 3: 6.76 sec per loop
> > 2.6: 10 loops, best of 3: 2.61 sec per loop
>
> I can't quite reproduce these results. On a 3.2GHz Pentium 4,
> running Linux 2.6.21, gcc 4.1.3, I get
>
> 3.0: 10 loops, best of 3: 728 msec per loop
> 2.6: 10 loops, best of 3: 558 msec per loop
>
> So it's only 30% slower, not 260%.

It's certainly possible that other architecture/os/compiler
combinations will generate different results, although I was able to
produce similar scaling results on my Core Duo in my MacBook Pro under
MacOS X 10.4.10 using gcc 4.0.1 (Apple build 5247).

> What puzzles me more is that on comparable machines, it
> runs 5 to 10 times as fast on Linux as it does on Windows.

The machines actually aren't that comparable.  The differences between
the P4 and PD are vast. Depending on which P4 revision you have (and 3
Ghz was available in more than one flavor - northwood, prescott, P4HT,
prescott 2M and cedar mill), your FSB is possibly up to 50% faster
than mine, and you may have 2MB of L2 cache.  Almost all available
3Ghz P4s had hyperthreading, and while I don't believe that would have
any effect in this case, I don't know (I don't believe HT ever
performed any "magic" on non-threaded code).

> Have you turned off optimization by any chance in the
> compiler (what compiler did you use, anyway)?

VC.NET 2005 Pro.  I did not optimize beyond what is in the Python
vcproj, but I ran both in release build configurations, which I
presume have some optimizations enabled, anyhow (It appears to set
/O2, but no more).

--
Nick


More information about the Python-3000 mailing list