Eric Jones, Enthought
Patrick J. Miller, Lawrence Livermore National Laboratory
Date: Thursday, July 25
Time: 10:45am - 11:30am
Location: Marina IV
The weave package allows the inclusion of C/C++ within Python code. It is part of Enthought's SciPy.org project. Embedding C/C++ within Python offers both another level of optimization to those who need it, and an easy way to modify and extend supported extension libraries such as wxPython. Inlining C/C++ code within Python generally results in speed ups of 1.5x to 30x speed-up over algorithms written in pure Python, and computational algorithms based on Numeric arrays often see a factor of 100 or more. Generally algorithms that require a large number of calls to the Python API don't benefit as much from the conversion to C/C++ as algorithms that have inner loops completely convertible to C/C++.
There are three basic ways to use weave. The weave.inline() function executes C/C++ code directly within Python, and weave.blitz() translates Python Numeric expression to C++ for fast execution. For those interested in writing extension libraries, the ext_tools module provides classes for building extension modules within Python.
More recent work on weave has focused on compiling Python byte-code into C extension functions on the fly. Patrick Miller will discuss the project in this area.
Most of weave's functionality should work on Windows and Unix, although some of its functionality requires gcc or a similarly modern C++ compiler that handles templates well.
For more information on weave, please visit: http://www.scipy.org/site_content/weave