osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

inheriting a large python code base


On 15Feb2014 12:10, Rita <rmorgan466 at gmail.com> wrote:
> i just inherited a large python code base and I would like to optimize the
> code (run faster). The application is a scientific application so I really
> don't understand the internal logic.
[...]

One thing I would keep in mind is that scientific applications
generally involve floating point math. That is subject to loss of
precision if done the wrong way.

If you are fiddling with a numeric algorithm (as opposed to plain
old data structure manipulations) I would want to be sure the code
you're changing is not done that way for a specific reason. Make
unit tests to check for correctness if possible. Make regression
tests to compare the results of your modified code against the
results from the original code on the same data.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au>

Plague, Famine, Pestilence, and C++ stalk the land. We're doomed! Doomed!
        - Simon E Spero