[NSWI004] Code evaluation - importance of efficiency

Vojtech Horky horky at d3s.mff.cuni.cz
Wed Oct 7 07:07:50 CEST 2020


Hello.

Dne 06. 10. 20 v 20:03 Ondřej Roztočil napsal(a):
> I would like to ask if the performance characteristics of the submitted 
> code are going to be taken into account for grading (or to what extent) 
> - in the first individual assignments and in the team project later. Are 
> there any general guidelines about what sort of trade-offs between 
> architectural/QoL considerations and efficiency (in either direction) 
> are reasonable? I am asking because there is obviously huge amount of 
> freedom when working in C, especially when starting almost from scratch 
> like we do.

Performance is not the foremost consideration. More important is 
correctness, clean design and a readable code. [AFAIK last year we 
penalized once only because the implementation was so bad that the test 
that normally run for 5 seconds took over 10 hours.]

As a rule of thumb: the tests finish within few seconds, exception are 
memory allocation tests that can take few minutes if we give MSIM more 
memory. More than that is a clear indication that there is something 
wrong. As a matter of fact, good hint is when you become impatient 
waiting for the test to finish ;-).

As a practical example: there are various APIs, where the user works 
with some kind of numerical id (consider PID - process id - in Linux). 
For each call, this id is internally translated to some structure 
containing actual data (e.g. process owner, statistics, command line 
etc.). In real-world OSes, there would be a red-black tree that is 
traversed when searching by the id. For this course, it is perfectly 
okay to traverse a linked list instead.

Hope this helps,
- VH


More information about the NSWI004 mailing list