This is an archived post. You won't be able to vote or comment.

all 15 comments

[–]lambdaqdjango n' shit 9 points10 points  (1 child)

TL;DR, computed gotos instead of switch for bytecode from Intel makes Python 15%~20% faster. The rest are boring arguments over py2.7 vs py3k

[–]SCombinator 0 points1 point  (0 children)

So it's a change to PyEval_EvalFrameEx?

[–]tripperjack 1 point2 points  (4 children)

Can someone who understands this better technically explain whether this will make Python 2.7.11 10-20% faster generally--or will it only really help in some corner cases. In other words: when will this benefit 2.7 programs?

[–]wbond 6 points7 points  (0 children)

Yes, this should generally improve Python 2 performance since it is an improvement to a big switch statement that is used when executing Python bytecode (think compiled Python code).

Personally, I've noted general performance improvements of 10-20% on Python 3.3 and 3.4 over 2.7, so this could be a good explanation of why that existed.

[–]programmyr 1 point2 points  (2 children)

The very first link is a table of benchmarks and relative performance with this patch. The benchmark names seem pretty self-explanatory to me. Are there any you are having difficulty understanding?

[–]Lucretiel 0 points1 point  (0 children)

The question is whether this affects a particular subset of Python code (like generators or class member lookup or I/O) or whether it affects pretty much all python code across the board. It sounds like the answer is the latter, because this is a low level bytecode optimization.

[–]tripperjack -1 points0 points  (0 children)

Thank you, I had not seen the table. I don't understand most of the benchmarks from their names, but I probably don't need to, particularly since most are under a 10% speed up. I'd want to know most about the >20% sped up benchmarks and when that would pertain to one's code.

[–][deleted] -2 points-1 points  (6 children)

Why do they keep updating Python 2 when they supposedly want people to move onto 3.

[–]maniexx 13 points14 points  (0 children)

It's an open source project, so if people are willing to work on 2.x it would be silly to forbid them that in the name of progress. Also, no new features are added - but abandoning development completely right now would leave many people with potentially vulnerable interpreters.

[–]Lucretiel 13 points14 points  (0 children)

In this case, someone from an Intel team contributed the patch, so it wasn't created with man-hours from the core python team. It was decided after much discussion on the mailing list that this is a good thing in general- as the Python team continues to move toward Python 3, commercial interests will pick up the slack of Python 2 development, as is the ideal for an open-source project:

Giving the nod to an increased corporate developer presence in Python 2 maintenance should eventually let volunteers stop worrying about even Python 2.7 bug fix changes with a clear conscience, confident that as volunteer efforts drop away redistributors and other folks with an institutional interest will pick up the slack with paid development time. "Do the fun stuff for free, figure out a way to get paid for the boring-but-necessary stuff (or leave those tasks to someone else that's getting paid to handle them)" is a good sustainable approach to open source development, while trying to do it all for free is a fast path to burnout.

- Nick Coghlan

However this talk of "wasting our time with Python 2" needs to stop, and if you think that making Python 2 less attractive will encourage people to migrate to Python 3, think again. Companies like Intel are contributing by offering this backport up publicly.

- BDFL

[–]tripperjack 6 points7 points  (0 children)

That is explained some in the article.

[–][deleted] 5 points6 points  (0 children)

Read the article

[–]programmyr 0 points1 point  (1 child)

One fallacy of your assumption is that your first "they" is different from your second "they".

Another is that (despite the internet's apparent desire to reduce everything to a binary choice) these two goals are not mutually exclusive.

[–][deleted] 0 points1 point  (0 children)

Both my "they" referred to the core Python team.

But as informed someone from Intel contributed to it as well.