On Fri, Jul 23, 2010 at 1:58 AM, stefan brunthaler <ste...@brunthaler.net> wrote: >> Do I understand correctly that you modify the byte code of modules/functions >> at runtime? >> > Yes. Quickening is runtime only optimization technique that rewrites > instructions from a generic instruction to an optimized derivative > (orignally for the Java virtual machine). It is completely hidden from > the compiler and has no other dependencies than the interpreter > dispatch routine itself.
How do you generate the specialized opcode implementations? Presumably that is done ahead of time, or you'd have to use a JIT, which is what you're avoiding. I'm guessing from your comments below about cross-module inlining that you generate a separate .c file with the specialized opcode bodies and then call through to them via a table of function pointers indexed by opcode, but I could be totally wrong. :) > Another benefit of using my technique is that a compiler could decide > to inline all of the functions of the optimized derivatives (e.g., the > float_add function call inside my FLOAT_ADD interpreter instruction). > Unfortunately, however, gcc currently does not allow for cross-module > inlining (AFAIR). (Preliminary tests with manually changing the > default inlining size for ceval.c resulted in speedups of up to 1.3 on > my machine, so I think inlinling of function bodies for the optimized > derivatives would boost performance noticeably.) There are a variety of solutions to getting cross-module inlining these days. Clang+LLVM support link-time optimization (LTO) via a plugin for gold. GCC has LTO and LIPO as well. >> Such an approach would also be very useful for Cython. Think of a profiler >> that runs a program in CPython and tells you exactly what static type >> annotations to put where in your Python code to make it compile to a fast >> binary with Cython. Or, even better, it could just spit out a .pxd file that >> you drop next to your .py file and that provides the static type information >> for you. This would be interesting. We have (obviously) have similar instrumentation in unladen swallow to gather type feedback. We talked with Craig Citro about finding a way to feed that back to Cython for exactly this reason, but we haven't really pursued it. Reid _______________________________________________ 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