Re: [Python-Dev] Program runs in 12s on Python 2.7, but 5s on Python 3.5 -- why so much difference?

2017-07-24 Thread Gregory P. Smith
On Mon, Jul 24, 2017 at 1:49 PM Wang, Peter Xihong < peter.xihong.w...@intel.com> wrote: > I believe we have evaluated clang vs gcc before (long time ago), and gcc > won at that time. > > > > PGO might have overshadowed impact from computed goto, and thus the latter > may no longer be needed. >

Re: [Python-Dev] Program runs in 12s on Python 2.7, but 5s on Python 3.5 -- why so much difference?

2017-07-24 Thread Wang, Peter Xihong
I believe we have evaluated clang vs gcc before (long time ago), and gcc won at that time. PGO might have overshadowed impact from computed goto, and thus the latter may no longer be needed. When the performance difference is as large as 50%, there could be various options to nail down the

Re: [Python-Dev] Program runs in 12s on Python 2.7, but 5s on Python 3.5 -- why so much difference?

2017-07-24 Thread Ben Hoyt
Thanks for testing. Oddly, I just tested it in Linux (Ubuntu), and get the same results as you -- Python 2.7.13 outperforms 3 (3.5.3 in my case) by a few percent. And even under a Virtualbox VM it takes 3.4 and 3.6 seconds, compared to ~5s on the host macOS operating system. Very odd. I guess

Re: [Python-Dev] Program runs in 12s on Python 2.7, but 5s on Python 3.5 -- why so much difference?

2017-07-18 Thread Nathaniel Smith
I'd probably start with a regular C-level profiler, like perf or callgrind. They're not very useful for comparing two versions of code written in Python, but here the Python code is the same (modulo changes in the stdlib), and it's changes in the interpreter's C code that probably make the

Re: [Python-Dev] Program runs in 12s on Python 2.7, but 5s on Python 3.5 -- why so much difference?

2017-07-18 Thread Ben Hoyt
Thanks, Nick -- that's interesting. I just saw the extra JUMP_FORWARD and JUMP_ABSOLUTE instructions on my commute home (I guess those are something Python 3.x optimizes away). VERY strangely, on Windows Python 2.7 is faster! Comparing 64-bit Python 2.7.12 against Python 3.5.3 on my Windows 10

Re: [Python-Dev] Program runs in 12s on Python 2.7, but 5s on Python 3.5 -- why so much difference?

2017-07-18 Thread Nick Coghlan
On 19 July 2017 at 02:18, Antoine Pitrou wrote: > On Tue, 18 Jul 2017 12:03:36 -0400 > Ben Hoyt wrote: >> The program is a pentomino puzzle solver, and it works via code generation, >> generating a ton of nested "if" statements, so I believe it's

Re: [Python-Dev] Program runs in 12s on Python 2.7, but 5s on Python 3.5 -- why so much difference?

2017-07-18 Thread Antoine Pitrou
On Tue, 18 Jul 2017 12:03:36 -0400 Ben Hoyt wrote: > Hi folks, > > (Not entirely sure this is the right place for this question, but hopefully > it's of interest to several folks.) > > A few days ago I posted a note in response to Victor Stinner's articles on > his CPython

[Python-Dev] Program runs in 12s on Python 2.7, but 5s on Python 3.5 -- why so much difference?

2017-07-18 Thread Ben Hoyt
Hi folks, (Not entirely sure this is the right place for this question, but hopefully it's of interest to several folks.) A few days ago I posted a note in response to Victor Stinner's articles on his CPython contributions, noting that I wrote a program that ran in 11.7 seconds on Python 2.7,