I have two tree data-structures that I made in C++ , and they give a response for range queries/point queries in that program. I am using Ubuntu. I need help in understanding the way to compare the performance of these two data structures (for answering the query in that program) in external memory. How can I do this?

I searched a lot on the Internet, and I didn't find any clear idea on how this is done. I know I can measure disk I/O, memory consumption, CPU usage, etc. using Ubuntu's dstat, and iostat commands. I need some accurate and professional way to do this.

  • 6
    Please do not ask the same question on multiple sites. If you think it is off topic for one, please flag it and ask for it to be migrated to the other site.
    – user40980
    Commented Jul 13, 2013 at 5:24
  • MichaelT,I m new to these sites. I'll take care of ur suggestion from now on. I don't think its off topic . SO ,SE are great websites most of the times i get my answers here. I created account recently so posted on multiple sites at the same time because it is very urgent for me to know the answer for my problem. I believe there are active expereinced programmers who help many people through these websites.
    – coder
    Commented Jul 15, 2013 at 7:16

1 Answer 1


Write a test program executing the same set of queries against the same set of data using either the first or the second data structures. Measure the running time for both scenarios. Compare.

Of course, you should make sure that your test queries are representative for the kind of queries you may have to execute in production. And you should make the number of queries big enough to be sure you measure actually the running time of the queries (and not the start-up time of your test program, for example).

EDIT: to your comment: for getting information about disk IO or memory consumption, I think you may look into the Linux "/proc" filesystem and check if it contains what you are after. For example, /proc/<your process id here>/smaps gives you the memory usage.

  • Doc Brown , i've already done what you suggested.I can see the time taken by these datastructures to answer ny queries. I am executing the query on a single dataset sufficiently large number of times to measuer the time. My concern is measuring disk IOs , memeory usage , cpu cycles etc.. how is that done?
    – coder
    Commented Jul 15, 2013 at 7:11
  • @coder: from your question I was under the impression you know already how to do this - utilize the tools you mentioned. I suggest you edit your questions and add some details to make clear what kind of problem you have. For example, why do you think dstat and iostat don't give you "an accurate and professional" solution?
    – Doc Brown
    Commented Jul 15, 2013 at 12:07
  • Doc Brown thnx for your revert.I want to know how to measure disk IO,read/write,cpu cycles used etc in answering querying by these datastructs.In dstat command how can i know if the disk read/write shown at that instant is for my code, it doesnt show the program name or pid etc.
    – coder
    Commented Jul 15, 2013 at 13:55
  • @coder: I still suggest you edit your question accordingly (didn't I write this?). This will bring it on top of the list of active questions again, and you will probably get some more attention by people now understanding what you really want.
    – Doc Brown
    Commented Jul 15, 2013 at 16:32
  • done editing.....
    – coder
    Commented Jul 15, 2013 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.