On Wed, Mar 27, 2013 at 12:38 AM, Cousin Stanley <cousinstan...@gmail.com> wrote: > Chris Angelico wrote: > >> Interesting, so your 3.x sum() is optimizing something somewhere. >> Strange. Are we both running the same Python ? >> >> I got those from apt-get >> .... > > I also installed python here under Debian Wheezy > via apt-get and our versions look to be the same .... > > -sk- > > 2.7.3 (default, Jan 2 2013, 16:53:07) [GCC 4.7.2] > > 3.2.3 (default, Feb 20 2013, 17:02:41) [GCC 4.7.2] > > CPU : Intel(R) Celeron(R) D CPU 3.33GHz > > > -ca- > > 2.7.3 (default, Jan 2 2013, 13:56:14) [GCC 4.7.2] > > 3.2.3 (default, Feb 20 2013, 14:44:27) [GCC 4.7.2] > > CPU : ??? > > > Could differences in underlying CPU architecture > lead to our differing python integer results ?
Doubtful. I have Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz quad-core with hyperthreading, but I'm only using one core for this job. I've run the tests several times and each time, Py2 is a shade under two seconds for inline/range_sum, and Py3 is about 2.5 seconds for each. Fascinating. Just for curiosity's sake, I spun up the tests on my reiplophobic server, still running Ubuntu Karmic. Pentium(R) Dual-Core CPU E6500 @ 2.93GHz. gideon@gideon:~$ python inttime.py 2.6.4 (r264:75706, Dec 7 2009, 18:45:15) [GCC 4.4.1] inline: 2147450880 2.7050409317 range_sum: 2147450880 2.64918494225 forloop: 2147450880 6.58765792847 forloop_offset: 2147450880L 16.5167789459 gideon@gideon:~$ python3 inttime.py 3.1.1+ (r311:74480, Nov 2 2009, 14:49:22) [GCC 4.4.1] inline: 2147450880 4.44533085823 range_sum: 2147450880 4.37314105034 forloop: 2147450880 12.4834370613 forloop_offset: 2147450880 13.5000522137 Once again, Py3 is slower on small integers than Py2. So where's the difference with your system? This is really weird! I assume you can repeat the tests and get the same result every time? ChrisA -- http://mail.python.org/mailman/listinfo/python-list