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.

PRG1 instructions

All questions concern prg1 instructions.

Affiliation in this project must always have …
Publication in this project must always have …
What are the limits on how many publications can one affiliation be associated with?
What are the limits on how many affiliations can be associated with a single publication?
Which of the following is true for publications?
Which of the following holds true for associative containers?
Which of the following ones are good choices for storing information about a single affiliation?
How do 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 get_all_affiliations 10 10 100;1000;10000;100000
Timeout for each N is 10 sec.
For each N perform 10 random command(s) from:
get_all_affiliations
     N ,    add (sec) ,   cmds (sec) ,  total (sec)
   100 ,      0.50000 ,    1         ,      1.50000
  1000 ,       1.0000 ,    2         ,       3.0000
 10000 ,      5.00000 ,    4         ,       9.0000
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 get_all_publications 20 10 100;1000;10000;100000
Timeout for each N is 20 sec.
For each N perform 10 random command(s) from:
get_all_publications
     N ,    add (sec) ,   cmds (sec) ,  total (sec)
   100 ,      0.50000 ,    1         ,      1.50000
  1000 ,       1.0000 ,    2         ,       3.0000
 10000 ,      5.00000 ,    4         ,       9.0000
100000 ,      8.00000 , 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 get_affiliation_name 10 10 5;10;50;100
Timeout for each N is 10 sec.
For each N perform 10 random command(s) from:
get_affiliation_name
      N ,    add (sec) ,   cmds (sec) ,  total (sec)
      5 ,      0.00004 , 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 get_all_affiliations 10 10 100;1000;10000;100000
Timeout for each N is 10 sec.
For each N perform 10 random command(s) from:
get_all_affiliations
      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 get_all_affiliations 10 times, when there are 10000 affiliations and publications?
How long it took to execute that? (in seconds, the same way as the output)
What is the command count for adding 1000 affiliations and publications?
What is the command count on adding 100000 publications and affiliations AND running get_all_affiliations 10 times?
What can be said by reading the perftest output: