inheriting a large python code base

craig at milhiser.com craig at milhiser.com
Fri Feb 21 22:36:20 CET 2014


Look at the algorithms and see if there are faster ways.  Great advice with the comments of writing test cases, getting into version control, taking passes through the code with tools, understanding what is slow and why it is considered slow.  Then you should invest the time to understand the internal logic and the algorithms.  Understand the performance O(N log N), O(N^2), O(2^N). See if there are better algorithms that should be used - is there an O(N).  Implement that algorithm, test, then compare performance.  Finally optimize the coding constructs.  Depending on how long your program takes (a few milli-secs, a few secs, a few hours, a few days), optimized coding constructs may make no measurable difference.  Finding better algorithms will.  But a better algorithm changing code from 2 milli-secs to 1 milli-sec is only useful in specific environments - so it may not be worth your effort.  Understand the performance of the code and the environment it is executed in.

That is how I have gone about it type of work.



More information about the Python-list mailing list