0

I've just submitted pset5 (phew, finally, after a long battle). Anyway, the question here is I notice that when I add all comments to the codes I used, the running time of the speller increasing by heaps (from only 0.14 seconds with less comments to 4.03 seconds with full comments). I'm wondering why this happens? If we are going to be graded on our running time, can we submit the one without any comments at all? Thanks in advance.

1

The number of lines marked as comment does not affect the run time of your program. Submissions are graded by whether or not they pass all the tests, run time does not affect your final grade.

You can submit whichever version you'd like as long as it passes all the tests.


PS. I assume that by

when I add all comments to the codes I used, the running time of the speller increasing by heaps.

You mean:

When I comment out the lines I have written, the running time of the program increases.

If that is wrong feel free to leave a comment explaining further what exactly it is you mean :)

  • Glad to hear that you think it shouldn't have any affect. But, I'm still confuse to why suddenly my running time jumps from 0.14 to just over 4 seconds. Anyway, good to know that it doesn't make any difference to the grading. Thanks for the answer. – MTreacy Nov 13 '16 at 6:41
  • M. Kleiven is right, comments are ignored by the compiler, can not affect the efficiency of the code, in the case of dictionary.c the speed of the code can vary greatly depending on the machine, the length of the text etc. , Be sure to always use the same dictionary and the same text for the tests, and execute them several times, so you have an idea of the average time. If the same thing happens to you I would like to see your code, of course it would be an interesting and atypical case – MARS Nov 13 '16 at 9:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .