I want to test which data structure is the best by looking at the run-time performance of my algorithm, how do I do it?
For example I already have a hashmap<string, int> hmp; assuming I have "apple" in my hashmap I want to know how long the following statement takes to execute: hmp["apple"].
How can I time it?
Thanks!
First of all take a look at my reply to this question; it contains a portable (windows/linux) function to get the time in milliseconds.
Next, do something like this:
All done! (Note that I haven’t tried to compile it)