MartinK12
Member
I heard somewhere that logical statements like if take more time to process then calculating variables so I wonder if I should leave all variable calculations alone or put them inside if statements.
For some basic example in step event - is the first way faster then the second?
Is it even worth doing this if check?
Of course this is basic example what I'm asking about but I'm talking about big project, so using 1st way or 2nd might have impact on performance or it won't?
BTW if you know some good resources (videos, tutorials, ebooks, etc) about performance questions like this I would appreciate all links bcs what I usually find are some random questions/comments and I could really use something more comprehensive. Thank You
For some basic example in step event - is the first way faster then the second?
Is it even worth doing this if check?
Of course this is basic example what I'm asking about but I'm talking about big project, so using 1st way or 2nd might have impact on performance or it won't?
BTW if you know some good resources (videos, tutorials, ebooks, etc) about performance questions like this I would appreciate all links bcs what I usually find are some random questions/comments and I could really use something more comprehensive. Thank You
GML:
//1st way
button_x1 = x;
button_y1 = y;
button_x2 = button_x1 + button_width;
button_y2 = button_y1 + button_height;
//2nd way
if (moving) {
button_x1 = x;
button_y1 = y;
button_x2 = button_x1 + button_width;
button_y2 = button_y1 + button_height;
}