# Optimization¶

In the early stages of NIPY development, we are focusing on functionality and usability. In regards to optimization, we benefit significantly from the optimized routines in scipy and numpy. As NIPY progresses it is likely we will spend more energy on optimizing critical functions. In our py4science group at UC Berkeley we’ve had several meetings on the various optimization options including ctypes, weave and blitz, and cython. It’s clear there are many good options, including standard C-extensions. However, optimized code tends to be less readable and more difficult to debug and maintain. When we do optimize our code we will first profile the code to determine the offending sections, then optimize those sections. Until that need arises, we will follow the great advice from these fellow programmers:

Kent Beck:

“First make it work. Then make it right. Then make it fast.”

“We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.”

Tim Hochberg, from the Numpy list:

0. Think about your algorithm.