Interesting work indeed.
From profiling CPython it has long been clear to me that enormous gains can be 
made by making instruction dispatching faster.  A huge amount of time is spent 
in the evaluation loop.  I have also been making small inroads to offline 
bytecode optimization.  Identifying common patterns and introducing special 
opcodes to deal with them.  Obviously using register addressing makes such an 
approach more effective.

(Working with code objects is fun and exciting, btw, and the reason for my 
patch http://bugs.python.org/issue16475)

K

From: Python-Dev [mailto:python-dev-bounces+kristjan=ccpgames....@python.org] 
On Behalf Of Victor Stinner
Sent: 17. nóvember 2012 01:13
To: Python Dev
Subject: [Python-Dev] Register-based VM for CPython


The WPython project is similar to my work (except that it does not use 
registers). It tries also to reduce the overhead of instruction dispatch by 
using more complex instructions.
http://code.google.com/p/wpython/

Using registers instead of a stack allow to implement more optimizations (than 
WPython). For example, it's possible to load constants outside loops and merge 
"duplicate constant loads".

I also implemented more aggressive and experimental optimizations (disabled by 
default) which may break applications: move loads of attributes and globals 
outside of loops, and replace binary operations with inplace operations. For 
example, "x=[]; for ...: x.append(...)" is optimized to something like "x=[]; 
x_append=x.append; for ...: x_append(...)", and "x = x + 1" is replaced with "x 
+= 1".

Victor
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to