Testing Implementations - dcobbley/AlgorithmsProject350 GitHub Wiki
Things we've done to test algorithms
Python
time:
time python Dijkstra.py
['a', 'c', 'd', 'e']
real 0m0.050s
user 0m0.013s
sys 0m0.022s
real - refers to the actual elasped time
user - refers to the amount of cpu time spent outside of kernel
sys - refers to the amount of cpu time spent inside kernel specific functions
From http://www.huyng.com/posts/python-performance-analysis/
cProfile:
python -m cProfile -s time Dijkstra.py
From https://pygabriel.wordpress.com/2010/04/14/profiling-python-c-extensions/
pycallgraph:
http://stackoverflow.com/a/11822995/2611779
Profiling Python:
https://zapier.com/engineering/profiling-python-boss/
http://ymichael.com/2014/03/08/profiling-python-with-cprofile.html
http://pymotw.com/2/profile/
Java
jconsole:
Use "jconsole ProcessID" to see a pretty graphs and usage information. (get PIDs by entering "jps" on the command line) This launches a GUI, so can't be done while SSH'd in to the servers. Documentation: http://docs.oracle.com/javase/7/docs/technotes/guides/management/jconsole.html
- Used so far on the Dijkstra's source code (min-priority queue using a balanced tree) taken from here: http://rosettacode.org/wiki/Dijkstra%27s_algorithm#Java
- Screenshot: https://github.com/dcobbley/AlgorithmsProject350/blob/master/jconsole.png