Optimizing Python scripts


Article from Issue 81/2007

The trick to optimization is to save time in the right places.

Optimization saves execution time. Unfortunately, optimizing lengthens development cycles. The optimized source code is typically more complex than the original code, which increases the time for testing and debugging. Adding complexity also makes the code more difficult to maintain. Because the optimization process takes time and adds complexity, it is best to avoid optimizing code while you are writing it. Before you start optimizing, start with a stable program. Once your program is stable and complete, you can look for ways to improve performance. In this article, I describe some strategies for optimizing Python programs.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Python 3

    What do Python 2.x programmers need to know about Python 3?

  • A Gaggle of Schedulers in Kernel Development Battle

    Really Fair - Really Simple, Really Fair - Really Unfair: three schedulers are the topic of current discussions on the kernel mailing list.

  • Diff Algorithms

    Diff finds the differences between two versions of a file. We’ll show you how diff finds changes and matches in files without affecting a system's resources.

  • Flam3 and Fractal Fr0st

    Few fractal algorithms create as beautiful and ethereal structures as Flam3. The Fr0st GUI helps you master the complex software.

  • Csound

    The powerful Csound software provides an impressive set of features for audio production and processing. We walk you through the entire system.

comments powered by Disqus

Direct Download

Read full article as PDF:

Optimizing_Python.pdf  (186.75 kB)