msg54813 - (view) |
Author: Sean Reifschneider (jafo) *  |
Date: 2006-05-22 11:43 |
At the Need for Speed sprint, Tim Peters asked if anyone had any need for integer bit operation performance improvement. Apparently, it's easy to improve, but nobody has said they need this. Please reply to this task if you have an application which needs this. |
|
|
msg54814 - (view) |
Author: Tim Peters (tim.peters) *  |
Date: 2006-05-22 12:29 |
Logged In: YES user_id=31435 Changed Category to Performance. The idea with this one is that the eval loop could easily inline "int & int", "int | int", "int ^ int", much as it inlines "int + int" today. |
|
|
msg83937 - (view) |
Author: Mark Dickinson (mark.dickinson) *  |
Date: 2009-03-21 15:51 |
To see what Tim's talking about here, see the 'big switch' ("switch opcode") in function PyEval_EvalFrameEx in Python/ceval.c, and look at the "case BINARY_ADD" bit. Inlining the bitwise operators should be even easier, since there are no overflow worries. (We do have to assume that C longs are two's-complement with no trap representation, but Objects/intobject.c does that already, so it's probably okay.) This only applies to 'short' integers, so I don't think it's relevant for Python 3.x. |
|
|
msg86584 - (view) |
Author: Daniel Diniz (ajaksu2) *  |
Date: 2009-04-26 01:08 |
There's a related patch in issue 1087418. |
|
|
msg86678 - (view) |
Author: Mark Dickinson (mark.dickinson) *  |
Date: 2009-04-27 16:42 |
I agree issue 1087418 is related, but why is it marked as a dependency for this issue? It seems to me that either of these feature requests could be implemented independently of the other: this one applies only to 2.x ints, while issue 1087418 applies only to 2.x longs and 3.x ints. |
|
|
msg86754 - (view) |
Author: Daniel Diniz (ajaksu2) *  |
Date: 2009-04-28 17:26 |
Mark: it was just my cluelessness showing :) |
|
|
msg86768 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2009-04-28 21:52 |
I don't think it's a good thing to special-case bitwise operations in the ceval loop. It will make the whole thing less instruction cache-friendly, just for the purpose of speeding up some very uncommon operations. |
|
|
msg86787 - (view) |
Author: Mark Dickinson (mark.dickinson) *  |
Date: 2009-04-29 09:18 |
It looks like no-one sees this as a useful optimization; it seems even less useful now given that it's not applicable to Python 3.x. Closing. |
|
|