So, is there a way to test efficiency of your code, or is it just over time you kind of learn what is more better for CPU and RAM usage and the likes.
An example I have two ways I have written this code below, is there a way to determine which is better?
if theUnit.active == true:
for button in buttons:
button.visible = true
else:
for button in buttons:
button.visible = false
#the other way I wrote it was
if theUnit.active == true:
accel.visible = true
decel.visible = true
turn_l.visible = true
turn_r.visible = true
else:
accel.visible = false
decel.visible = false
turn_l.visible = false
turn_r.visible = false
So the for loop uses buttons as an array that holds the four references to the buttons, so that is an extra variable that is used with that method. Not sure if one is superior over the other. Or how to figure out a way to determining that.