Prg1 starting exercises

These exercises check that you have understood the prg1 and prg1-opt instructions, help you to start working for the prg1, and verify that you know how to test locally your code.

All questions relate to the prg1 documentation.

A place must have
Place ..
An area has
An area
How many subareas can a single area have?
What are good choices for storing a place data?
How can you change the working directory in Qt Creator?

PRG1 instructions on testing

All questions concern prg1 instructions on testing. The perftest outputs later in this exercise are not real data, the data should not be used for comparison with your own implementation.

Functionality test can be run with
Performance test can be run with
Functionality tests show differences, what to do now?
What is important to note when running perftests?
What is said about using command counters as a measure of performance?

Next couple of questions consider the perftest output below

> perftest 10*all_places 10 100;1000;10000;100000
Timeout for each N is 10 sec (for ADD and test functions).
For each N perform command(s):
all_places

     N ,    add (sec) ,   cmds (sec) ,  total (sec)
   100 ,    0.5000000 ,  1.000000000 ,    1.5000000
  1000 ,     1.000000 ,   2.00000000 ,     3.000000
 10000 ,      5.00000 ,    4.0000000 ,      9.00000
100000 , ADD Timeout!
>
What function is being perftested?
Did the perftest time out/ fail? If so, why?

Next couple of questions consider the perftest output below

> perftest 10*all_places 20 100;1000;10000;100000
Timeout for each N is 20 sec (for ADD and test functions).
For each N perform command(s):
all_places

     N ,    add (sec) ,   cmds (sec) ,  total (sec)
   100 ,  0.500000000 ,     3.000000 ,     3.500000
  1000 ,   1.00000000 ,      6.00000 ,      7.00000
 10000 ,    5.0000000 ,      12.0000 ,       17.000
100000 ,    8.0000000 , Timeout!
>
What is the timeout (in seconds) used for the perftest?
How many times the command to be tested is run for each N?
Why did the command print Timeout!?

Next couple of questions consider the perftest output below

> perftest 10*get_place_name 10 5;10;50;100
Timeout for each N is 10 sec (for ADD and test functions).
For each N perform command(s):
get_place_name

      N ,    add (sec) ,   cmds (sec) ,  total (sec)
      5 ,   2.9655e-05 , terminate called after throwing an instance of 'std::out_of_range'
  what():  unordered_map::at
Aborted (core dumped)
What happened in the perftest?

Next couple of questions consider the perftest output below

> perftest 10*all_places 10 100;1000;10000;100000
Timeout for each N is 10 sec (for ADD and test functions).
For each N perform command(s):
all_places

     N ,    add (sec) ,  add (count) ,   cmds (sec) , cmds (count) ,  total (sec) , total (count)
   100 ,  0,000112247 ,       280203 ,   3,5244e-05 ,        43740 ,  0,000147491 ,       323943
  1000 ,  0,000116914 ,       569395 ,   3,8864e-05 ,        74040 ,  0,000155778 ,       643435
 10000 ,   0,00051654 ,      2740514 ,   8,6724e-05 ,       317460 ,  0,000603264 ,      3057974
100000 ,  0,000976794 ,      5443984 ,  0,000131009 ,       619420 ,    0,0011078 ,      6063404
>
What is the command count for running all_places 10 times, when there are 10000 places?
How long did it take in total to execute the case from the previous question, including the time spent on adding the test data in addition to the time used for executing the commands? (in seconds, the same format as in the output)
What is the command count when adding 1000 places among other data?
What is the total command count when adding AND running all_places 10 times when the number of places (N) is 100000?
What can be said by reading the perftest output: