Optimization is a vast topic, and there is a lot that you can do. If you are interested in knowing more about code optimization, you can start with the official Python optimization tips that are available at http://wiki.python.org/moin/PythonSpeed/PerformanceTips.