On 11/03/2016 05:29, Steven D'Aprano wrote:
On Fri, 11 Mar 2016 06:26 am, Mark Lawrence wrote:
No mention of speed anywhere, but then what does that silly old Tim
Peters know about anything?
The truth is, most people don't -- most Python code uses very little of the
dynamic features that get in the way of optimizing the interpreter, things
like intentionally shadowing or monkey-patching built-ins, adding
attributes to objects on the fly, or using exec and eval. In my dream
language, I wish that there were a way to tell the compiler "this is code
(function, class, module) is not dynamic, optimize it as much as you can".
The problem is the compiler has to have sight of the code for that to
work. That means looking inside an imported module, which I think
doesn't happen when running the byte-code compiler, but executing the
resulting byte-code.
Anyway, I've listed some of the stumbling blocks I think that Python has
in making it bit faster: http://pastebin.com/WfUfK3bc
Solving all that won't magically make it a magnitude quicker, but
noticeably brisker. And could open the way for further speed-ups.
Unfortunately you can't these issues without radical changes to the
language ...
Or better still, for the compiler itself to recognise when code is static,
and optimize it. Victor Stinner's FAT Python may be that compiler some day,
and I for one can't wait.
... unless you take the complicated approach as this project seems to!
(Mine would be to design the language to be less dynamic in the first
place.)
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list