Tim Hochberg wrote:
Travis Oliphant wrote:
David M. Cooke wrote:
I couldn't leave it at that :-), so I wrote my bytecode idea up.
I like what you've done. It makes me wonder what could be done with just a Python-level solution (that might be easier to generalize to more data-types and operators).
I tried hand coding stuff at the pure Python level to see how close I could come to David's results. I performed the operations in chunks (larger chunks than he did so that Python overhead didn't kill me) For the second case he presents (2*a+3*b), I managed to get a 70% speedup. While not negligible, it's a far cry from the 180% speedup I saw with David's code for the same result. So while doing things at the Python level would certainly be easier, the payoff isn't likely to be nearly as big.
That's good information. Still, it might be useful for more general-operators and data-types to have something that does essentially this in Python only. Then, if you have a simpler expression with a few select data-types you could have the big-speed up with something more specific. -Travis