How do you measure your code performance?


New Member
Some languages come with built-in debugging modules/functions, while others just let the programmer do the same,by comparing the time values at the beginning and the end. Some IDE's and clients give nice ways to watch the stack add breakpoints and so on.

1. Do do you measure performance of your code, if so how ?
2. Make a wild guess as to how long it would take a language of your choice to brute force its way though all permuations and combinations for a single character password.

PS: special mention to firefug - the invaluble browser addon.


Active Member
my few cents
a. Free up used memory to avoid memory leakages.
b. Close open connections (related to any DB) for unnecesary timeout wait
c. Optimize loop usage ... try to use same loop defined in a function, this will give a chance to cache contents instead of going inside the function.
d. Conditions statements should not be encountered more than once
eg: this is a nonsence condition flow, can be optimized a lot
if (a > b) then
if (a > c) then
print a is greater
end if
if (b > c) then
print b is greater
end if
end if
e. Try to avoid loop if not necessary, this will give great performance boost
Finally profile your code and see the results given by the profiler
While deploying the application on IIS / Tomcat / other app servers, make sure to set optimal settings on memory heap, thread settings to serve concurrent real time users

2. PERL - king of regular expression

Lord Nemesis

Depending on the context, I use tools as simple as a stop watch application to as complex as professional profiling applications like DevPartner Performance Analysis on Windows and Shark on Mac. We are also currently trying to deploy our own home grown automated performance profiling and code coverage support into our product code bases where by reports can be generated on a daily basis and problem areas caught immediately.


New Member
Time Complexity and Space Complexity. The tried and tested methods of checking out how good an algorithm is. I still do these checks first when I analyze my code. :)