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.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to