Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

Notice Board

Per partecipare al corso di Fondamenti di programmazione 2023-24 loggatevi e attivatelo nella vostra pagina dei corsi preferiti. A quel punto il corso appare nel menù personale cliccando sul proprio avatar. Per i materiali degli anni precedenti seguite lo stesso metodo.

To join the Programming/Lab 2023-24 course, log-on and select it on the my courses page. It will appear on the personal menu of your avatar. For earlier years use the same method.

My code for HW2 keeps getting slower

Beray Nil Atabey (7510 points)
13 33 97
in HW2 by (7.5k points)
recategorized by

So I uploaded the same thing and it gave me 4.2 first and then 4.4, I wanted to test why so I uploaded the exact same code again and now I'm at 4.6 efficiency. Is there any way to solve this issue?

For the record: I uploaded the same file but I was changing the algorithm, I wasn't trying to mess with the system or anything.

630 views
closed with the note: Understood

3 Answers

Diapa (4690 points)
0 1 28
by (4.7k points)

Depending on a lot of variables that are outside the code itself, it is possible that the time changes between runs, also if with the same code. Take for example when you first run it on your PC and when then you run it a second time shortly after: you could go from a first time of 2.10s to 0.8s, and that happens because the functions and the variables of the code are still saved in the RAM during the second run, while in the first they're not. A lot depends from the PC's prestation on the execution time, you could say that's beyond our control. Moreover in your case we're talking about a really small amount of time (which is per se a really good time, a lot of people (myself too) struggle to get slightly less than the average), so don't worry too much about it

r0mania (2580 points)
1 2 13
by (2.6k points)
The code that you upload on the site shouldn't have variations as it has to be objective. So to check the "effective" efficiency upload the code on the site, the efficiency should be the same if the code is the same.
Beray Nil Atabey (7510 points)
13 33 97
by (7.5k points)
but it's not ???
francesco.calzona (5210 points)
5 20 81
by (5.2k points)
The testing machine seems to have some fluctuation from one test to another. The only thing I can suggest you is to try to submit your code in strange hours (e.g. at night) because (but it is a completely empirical assumption and I might be dead wrong) it seems to me that there is some sort of correlation among the number of submission made at the same time and the efficiency you get.
Diapa (4690 points)
0 1 28
by (4.7k points)
It could be that: I tried to submit it around 18:30 and it gave me a better score than around 14:00
Taiel26 (1570 points)
3 6 16
by (1.6k points)
I uploaded my code and then made a modification since it wasn't faster I uploaded the previous code again and it went from 8.9 to 9.8 so I tried uploading it again and it went all the way up to 11.1, I later uploaded it late at night an it said 8.8.