On Wed, Mar 27, 2013 at 3:41 AM, Cousin Stanley <cousinstan...@gmail.com> wrote: > > Chris Angelico wrote: > >> Once again, Py3 is slower on small integers than Py2. > > Chris Angelico > Ubuntu Karmic. > Pentium(R) Dual-Core CPU E6500 @ 2.93GHz. > > python inline range_sum forloop forloop_offset > > 2.6.4 2.7050 2.6492 6.5877 16.5168 > > 3.1.1 4.4453 4.3731 12.4834 13.5001 > > You do seem to have a slight py3 improvement > under ubuntu for the forloop_offset case ....
Yes, that's correct. The forloop_offset one is using long integers in all cases. (Well, on Py2 it's adding a series of ints to a long, but the arithmetic always has to be done with longs.) Python 3 has had some improvements done, but the main thing is that there's a massive spike in the Py2 time, while Py3 has _already paid_ that cost - as evidenced by the closeness of the forloop and forloop_offset times on Py3. ChrisA -- http://mail.python.org/mailman/listinfo/python-list