Hi !
Two things going on.
efficiency = self.efficiency() at the top of the script captures the number 0 once into a variable. The print inside the loop is using that captured value, not re-calling the method.
Also, notice there was a real one-tick lag bug where `efficiency()` returned the previous tick's value (so even a correct loop banked the wrong optimum); that's fixed in the latest demo build I'm pushing now. Should give you clean readings. With your sleep it would fine anyway.